Tencent network adapter code
How to judge the type of machine that accesses the website-How to judge the ipad JS to judge the browser client type (ipad,iphone,android) <script type= "Text/javascript" >& nbsp <!-- //platform, equipment and operating system var system = { &NBSP ; win:false, mac:false, &N Bsp xll:false, ipad:false &NB Sp }; //test platform var p = navigator.platform; &NB Sp System.win = P.indexof ("win") = = 0; SYSTEM.MAC = P.indexof ("mac") = = 0;&nb Sp system.x11 = (p = = "X11") | | (P.indexof ("Linux") = = 0; System.ipad = (Navigator.userAgent.match (/ipad/i)!= null)? t rue:false; //jump statements, if the phone is accessed automatically jump to WAP.Baidu.com page if (System.win | | system.mac | | system.xll| | System.ipad) { } else { WI Ndow.location.href = "http://www.jdpatro.com/3g/"; } --> </script > Tencent network adapter code <SCRIPT type= "Text/javascript" > if (/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)) { if (Window.location.href.indexOf ("? mobile") <0) { try{ if (/android|webos|iphone|ipod| Blackberry/i.test (navigator.useragent)) { window.location.href= "http://shipei.qq.com/index.htm"; &NBsp }else if (/ipad/i.test (navigator.useragent)) { }else{ & nbsp window.location.href= "http://shipei.qq.com/simple/s/index/" } }catch (e) {} } } ;/script> <script type= "Text/javascript" > var browser = { &N Bsp Versions:function () { var u = navigator.useragent, app = Navigator.appve rsion; return {//mobile terminal browser version info &NB Sp Trident: U.indexof (' Trident ') >-1,//ie kernel & nbsp Presto:u.indexof (' Presto ') >-1,//opera kernel &NB Sp &NB Sp Webkit:u.indexof (' AppleWebKit ') >-1,//Apple, Google kernel GECKO:U . IndexOf (' Gecko ') >-1 && u.indexof (' khtml ') = = 1,//Firefox kernel &NB Sp Mobile:!! U.match (/applewebkit.*mobile.*/) | | !! U.match (/applewebkit/),//Whether for mobile terminals &NBS P &NBSp iOS:!! U.match (/(i[^;] +;( U;)? Cpu.+mac OS x/),//ios terminals Android:u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1,//android terminal or UC browser &NBSP ; iphone:u.indexof (' IPhone ') >-1 | | U.indexof (' Mac ') >-1,//whether for iphone or Qqhd browser ipad:u.indexof (' IPad ') >-1,//Whether or not the IPad &N Bsp webapp:u.indexof (' Safari ') = = -1,//Whether the web should be programmed, without head and bottom &NBSP ; Google:u.indexof (' Chrome ') >-1 }; } (), LanguagE: (navigator.browserlanguage | | navigator.language). toLowerCase () } Document.writeln ("language version:" +browser.language); Document.writeln ("is mobile Terminal:" + Browser.versions.mobile); </script> How to determine the type of machine to visit the site-how to tell if ipad how to determine whether it is an ipad browser, the key is to see its Whether there is an iPad in the User Agent. The ipad uses the Safari Mobile browser, and his user Agent is: mozilla/5.0 (ipad; U CPU os 3_2 like Mac os X; En-US) applewebkit/531.21.10 (khtml, like Gecko) version/4.0.4 mobile/7b334b safari/531.21.10 function Is_ipad () { [object Object] [Object] [object Object]var ua = Navigator.userAgent.toLowerCase ( ); [object Object] [Object Object] [object Object]if (Ua.match (/ipad/i) = "IPad") { &N Bsp [object Object] [Object Object] [Object Object] [Object Object] [Object Object] [Object]return True [object Object] [Object Object] [object]} else {  [Object Object] [Object Object] [Object Object] [Object Object] [Object Object] [Object Object]return false; [object Object] [Object Object] [object]} $is _ipad = (bool) strpos ($_server[' http_user_agent ' ], ' iPad '; Rewritecond%{http_user_agent} ^.*ipad.*$ rewriterule ^ (. *) $ http://ipad.fairyfish.net [r=301] JS To determine the browser client type (ipad,iphone,android) <script type= "Text/javascript" > var bforcepc = Fgetquery ("dv") = = "PC"; function fbrowserredirect ()- var suseragent = Nav Igator.userAgent.toLowerCase (); var bisipad = Suseragent.match (/ipad/i) == "ipad"; var Bisiphoneos = Suseragent.match (/iphone os/i) = = "iphone OS"; var BISMIDP = Suseragent.match (/midp/i) = = "MIDP"; var bIsUc7 = Suseragent.match (/rv:1.2.3.4/i) = = "rv:1.2.3.4"; var bisuc = Suseragent.match (/ucweb/i) = = "UCWeb"; var bisandroid = Suseragent.match (/android/i) = = "Android"; var bisce = Suseragent.match (/windows ce/i) = = "Windows CE"; var biswm = Suseragent.match (/windows mobile/i) = = "windows mobile"; if (bisipad) { var sURL =  ; Location.href; if (!BFORCEPC) { &NBS P &NBSP;WINDOW.LOCATION.HREF = "http://ipad.mail.163.com/"; &NBSP, ,  , &NB Sp if (Bisiphoneos | | bisandroid) { var surl = location.href; if (!BFORCEPC) { &NB Sp window.location.href = "http://smart.mail.163.com/"; &NBSP, ,  , &NB Sp if (bismidp| | bisuc7| | bisuc| | bisce| | BISWM) { var surl = location.href; if (!BFORCEPC) { windo W.location.href = "http://m.mail.163.com/"; } &n Bsp function Fgetquery (name) {//Get parameter value var sURL = WINDOW.LOCATION.SEARCH.SUBSTR (1); var r = Surl.match (New RegExp ("(^|&)" + Name + "= ([^&]*) (&|$)")); return (r = null? Null: (R[2)); &NBSP} function Fshowverblock () { i F (bforcepc) { document.getelementbyidx_x ("Dv_block"). Style.display = "block"; &NBSP, else{ document.getelementbyidx_x ("Ad_block"). Style.display = "block"; } } fbrowserredirect (); </script>