<span style= "Font-size:24px;color: #ff0000;" > Mobile Terminal:</span>
<span style= "Font-size:14px;color: #339999;" >//Judgment Browser var browser = {Versions:function () {var u = navigator.useragent, app = Navigator.appversion;return {trident: U.indexof (' Trident ') >-1,//ie core presto:u.indexof (' Presto ') >-1,//opera kernel webkit:u.indexof (' AppleWebKit ') > -1,//Apple, Google kernel gecko:u.indexof (' Gecko ') >-1 && u.indexof (' khtml ') = =-1,//Firefox core mobile:!! U.match (/applewebkit.*mobile.*/) | | !! U.match (/applewebkit/),//Whether for Mobile terminal iOS:!! U.match (/(i[^;] +\;(U;)? Cpu.+mac OS X)/),//ios terminal android:u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1,//android terminal or UC Browser iphone:u.indexof (' IPhone ') >-1 | | U.indexof (' Mac ') >-1,//whether for iphone or Qqhd browser ipad:u.indexof (' IPad ') >-1,//whether Ipadwebapp:u.indexof (' Safari ') = = 1 Whether the web should be program, no header with bottom};} (), Language: (Navigator.browserlanguage | | navigator.language). toLowerCase ()};//detect if a mobile client accesses function IsMobile () { Return/applewebkit.*mobile/i.test (navigator.useragent) | | (/midp| symbianos| nokia| Samsung| Lg|nec| tcl| alcatel| bird| dbtel| dopod| philips| haier| lenovo| mot-| nokia| sonyericsson| sie-| amoi| Zte/.test (navigator.useragent));//browser.versions.android | | Browser.versions.iPhone | | Browser.versions.iPad;} </span>
PC side:
function Getos ()
{
var osobject = "";
if (navigator.userAgent.indexOf ("MSIE") >0) {
return "MSIE";
}
if (Isfirefox=navigator.useragent.indexof ("Firefox") >0) {
return "Firefox";
}
if (Issafari=navigator.useragent.indexof ("Safari") >0) {
return "Safari";
}
if (Iscamino=navigator.useragent.indexof ("Camino") >0) {
return "Camino";
}
if (Ismozilla=navigator.useragent.indexof ("gecko/") >0) {
return "Gecko";
}
}
alert ("Your browser type is:" +getos ());
Using JS to determine the mobile phone and the PC-side browser Core