This article uses the Device.js plug-in to determine the mobile device
Address: Https://github.com/matthewhudson/device.js
Example:
if (Device.mobile ()) {window.location.href = "mobile address"; Alert ("Mobile Side");} else { window.location.href = "PC-side address"; Alert ("PC-side");}
More equipment to determine the following table:
Device |
JavaScript Method |
Mobile |
Device.mobile () |
Tablet |
Device.tablet () |
Desktop |
Device.desktop () |
Ios |
Device.ios () |
Ipad |
Device.ipad () |
Iphone |
Device.iphone () |
Ipod |
Device.ipod () |
Android |
Device.android () |
Android Phone |
Device.androidphone () |
Android Tablet |
Device.androidtablet () |
BlackBerry |
Device.blackberry () |
BlackBerry Phone |
Device.blackberryphone () |
BlackBerry Tablet |
Device.blackberrytablet () |
Windows |
Device.windows () |
Windows Phone |
Device.windowsphone () |
Windows Tablet |
Device.windowstablet () |
Firefox OS |
Device.fxos () |
Firefox OS Phone |
Device.fxosphone () |
Firefox OS Tablet |
Device.fxostablet () |
Meego |
Device.meego () |
Television |
Device.television () |
Device.js will append the appropriate device style to your HTML node after use
Device |
CSS Classes |
Ipad |
iOS ipad tablet |
Iphone |
iOS iphone Mobile |
Ipod |
iOS ipod Mobile |
Android Phone |
Android mobile |
Android Tablet |
Android tablet |
BlackBerry Phone |
BlackBerry Mobile |
BlackBerry Tablet |
BlackBerry Tablet |
Windows Phone |
Windows Mobile |
Windows Tablet |
Windows tablet |
Firefox OS Phone |
Fxos Mobile |
Firefox OS Tablet |
Fxos tablet |
Meego |
Meego |
Desktop |
Desktop |
Television |
Television |
Mobile Device Direction judgment
Orientation |
JavaScript Method |
Landscape |
Device.landscape () |
Portrait |
Device.portrait () |
JS judge Mobile end and PC side