Ejemplo 1. Juicio simple y crudo de puntos faltantes
<script type = "text/javaScript"> var Suseragent = navigator.useragent.tolowercase (); var bisipad = Suseragent.match (/ipad/i) == "iPad"; var bisiphoneos = Suseragent.match (/ii) == "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 || bisiphoneos || bismidp || bisuc7 || bisuc || bisandroid || bisce || biswm) {window.location.href = "3g.php"; } </script>Ejemplo 2: El código es ordenado, y muchas funciones se basan en esta función adicional.
<script> var pc_style = "" var browser = {versions: function () {var u = navigator.useragent, app = navigator.appverversion; return {trident: u.indexof ('trident')> -1, presto: u.indexof ('presto')> -1, webkit: u.indexof ('manzanwebkit') u.indexof ('gecko')> -1 && u.indexof ('khtml') == -1, mobile: !! u.match (/applewebkit.*mobile.*/) || !! u.match (/appleWebkit/) && u.indexof ('qihu') && u.indexof ('qihu')> -1 && u.indexof ('chrome') <0, iOS: !! u.match (// (i [^;]+; (u;)? CPU.+Mac OS X/), Android: u.inDexof ('') U.IndexOf ('Linux')> -1, iPhone: U.IndexOf ('iPhone')> -1 || navigator.language) .tolowercase ()} if (browser.versions.mobile &&! browser.versions.ipad) {this.location = "Ingrese la dirección de la página de inicio de la estación de micro Jump aquí";} </script>Ejemplo 3: Se han agregado algunas funciones
< document.getElementById (id): id;}; var browser = {versions: function () {var u = navigator.useragent, app = navigator.appverversion; return {trident: u.indexof ('trident')> -1, presto: u.indexof ('presto')> -1, webkit: u.indexof ('applewebkit') -1, gecko: u.indexof ('gecko')> -1 && u.indexof ('khtml') == -1, mobile: !! u.match (/applewebkit.*Mobile.*/) || !!u.match(/AppleWebKit/),ios: !!u.match(//(i[^;]+;( U;)? CPU.+Mac OS X/),android : u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,iPhone : u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1,iPad : u.indexof ('iPad')> -1, webapp: u.indexof ('safari') == -1, qqbrw: u.indexof ('mqqbrowser')> -1, uClowend: u.indexof ('ucweb7.')> -1, ucspecial: u.indexof ('rv: 1.3.4' ')> -1, uC:) {try {return parsefloat (u.match (/ucweb/d+/./d+/gi) .ToString (). Match (// d+///d+/). ToString ())> = 8.2} Catch (e) {if (u.indexof ('uc')> -1) {return true;} floals;}}}} (}, (), (), (), symbiAN: U.IndexOf ('Symbian')> -1, UCSB: U.IndexOf ('Firefox/1.')> -1};} ()} var _gaq = _gaq || rf.tolocalElowerCase (). IndexOf (". Xiu.com") === -1) {var defaultJumpDomain = ""; if (defaultJumpDomain == "www") {return;} if (defaultJumpDomaAn == "m") {window.location.href = "http://wap.xiu.com/ == Undefined || Screen.Width <810) {if (browser.versions.ipad == true) {return;} if (browser.webkit == true || browser.versions.mobile == true || browser.ios == verdad browser.versions.ucspecial == true) {win.location.href = "http://wap.xiu.com/?from=pc" ;return; shap. </script>-> <!-Smartphone Judge End->Ejemplo 4: Recomendado para usar el wulin.com simple. Si tiene un mejor código, puede compartirlo.
<script type = "text/javaScript"> var browser = {versions: function () {var u = navigator.useragent, app = navigator.appversion; return {trident: u.indexof ('trident')> -1, presto: u.indexof ('presto')> -1, webkit: u.indexof ('manzana) u.indexof ('gecko')> -1 && u.indexof ('khtml') == -1, mobile: !! u.match (/applewebkit.*mobile.*/) || !!u.match(/AppleWebKit/),ios : !!u.match(//(i[^;]+;( U;)? CPU.+Mac OS X/),android : u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,iPhone : u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1,iPad : u.indexof ('iPad')> -1, webapp: u.indexof ('safari') == -1, qqbrw: u.indexof ('mqqbrowser')> -1, weixin: u.indexof ('micromessenger')> -1, uClowend: u.indexof ('uCweB7. u.indexof ('rv: 1.2.3.4')> -1, ucweb: function () {try {return parsefloat (u.match (/ucweb/d+/./d+/gi) .ToString (). -1) {return true;} else {return false;}}} (), symbian: u.indexof ('symbian')> -1, ucsb: u.indexof ('firefox/1.')> -1};} (), liulanqi: navigator.useragent} if (browser.vers.qbrw) navegador ");} else {document.write (" otro navegador "+browser.liulanqi);} </script>