如何判斷各mobile方式!!
使用方式
判斷Ipad
var isiPad = /ipad/i.test(navigator.userAgent.toLowerCase()); if (isiPad) { ... }
判斷Iphone
var isiPhone = /iphone/i.test(navigator.userAgent.toLowerCase()); if (isiPhone) { ... }
判斷 Ipod
var isiPod = /ipod/i.test(navigator.userAgent.toLowerCase()); if (isiPod) { ... }
判斷 IOS
var isiDevice = /ipad|iphone|ipod/i.test(navigator.userAgent.toLowerCase()); if (isiDevice) { ... }
判斷Andriod
var isAndroid = /android/i.test(navigator.userAgent.toLowerCase()); if (isAndroid) { ... }
判斷 BlackBerry
var isBlackBerry = /blackberry/i.test(navigator.userAgent.toLowerCase()); if (isBlackBerry) { ... }
判斷 WebOs
var isWebOS = /webos/i.test(navigator.userAgent.toLowerCase()); if (isWebOS) { ... }
判斷 Windows Phone
var isWindowsPhone = /windows phone/i.test(navigator.userAgent.toLowerCase()); if (isWindowsPhone) { ... }
轉貼
http://detectmobilebrowsers.com/
http://www.sitepoint.com/detect-mobile-devices-jquery/