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.
精彩评论