Method One:
function Gopage () {if (Navigator.userAgent.match (/(phone|pad|pod|iphone|ipod|ios|ipad| android| mobile| blackberry| iemobile| mqqbrowser| juc| fennec|wosbrowser| Browserng| webos| symbian| (Windows phone)/i)){window.location.href= "mobile Address";}} Else {window.location.href= "Your computer version address"; }} Gopage ();
Method Two:
//platforms, devices, and operating systems varsystem ={win:false, Mac:false, XLL:false, ipad:false }; //Testing Platform varp =Navigator.platform; System.win= P.indexof ("Win") = = 0; System.mac= P.indexof ("Mac") = = 0; System.x11= (P = = "X11") | | (P.indexof ("Linux") = = 0); System.ipad= (Navigator.userAgent.match (/ipad/i)! =NULL)?true:false; //Jump Statement, if it is mobile Access will automatically jump to the wap.baidu.com page if(System.win | | system.mac | | system.xll| |system.ipad) {}Else{window.location.href= "Mobile Address";
}
JS Judge pc Phone display different content