检查用户在网站上使用的平台

Ada*_*ung 0 javascript web

我有一个网站.如果他来到我的网站,我想知道他正在使用哪个用户.例如.iOS,Android,Windows手机,Windows PC.特别是对于iOS,我想检查他是在iPhone还是现在

Rak*_*iya 6

javaScript:http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with -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());
}
Run Code Online (Sandbox Code Playgroud)

};