开发者

iPhone/Android/etc detection, Mootools way?

Is there a Mootools way to detect iPhone/Android/others ? I have this Vanilla JS script :

if ( navigator.userAgent.match(/Android/i) || navigator.userAgent.开发者_开发问答match(/BlackBerry/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/Palm/i) )
{
   window.location = 'address-to-iphone-site';
}

I know how to do this for browsers (jsfiddle, but not for smartphones.

Any help would be welcomed.


Just have a look in the docs: http://www.mootools.net/docs/core/Browser/Browser

  • Browser.Platform.ios - (boolean) True if the platform is iOS.
  • Browser.Platform.webos - (boolean) True if the platform is WebOS
  • Browser.Platform.android - (boolean) True if the platform is Android


You can use Handset Detection for mobile browser detection & redirection. (Disclaimer : I run Handset Detection). Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜