检查用户在访问网站时使用的是哪个平台
Check which platform is user using while he is on a website
我有一个网站。如果他访问了我的网站,我想知道他使用的是哪个用户。例如。 iOS, Android, Windows phone, Windows 个。专门针对 iOS,我想检查他是在 iPhone 还是现在
library for detecting mobile clients here: http://mobiledetect.net
include 'Mobile_Detect.php';
$detect = new Mobile_Detect();
// Check for any mobile device.
if ($detect->isMobile())
// mobile content
else
javaScript:
http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices- 与-javascript/.
var isMobile = {
Android: function()
{
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function()
{
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function()
{
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function()
{
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function()
{
return navigator.userAgent.match(/IEMobile/i);
},
any: function()
{
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
我有一个网站。如果他访问了我的网站,我想知道他使用的是哪个用户。例如。 iOS, Android, Windows phone, Windows 个。专门针对 iOS,我想检查他是在 iPhone 还是现在
library for detecting mobile clients here: http://mobiledetect.net
include 'Mobile_Detect.php';
$detect = new Mobile_Detect();
// Check for any mobile device.
if ($detect->isMobile())
// mobile content
else
javaScript: http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices- 与-javascript/.
var isMobile = {
Android: function()
{
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function()
{
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function()
{
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function()
{
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function()
{
return navigator.userAgent.match(/IEMobile/i);
},
any: function()
{
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};