Beispiel 1. Einfaches und grobes Urteil über fehlende Punkte
<script type = "text/javaScript"> var suseragent = navigator.useragent.tolowerCase (); var Bissipad = 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 (Bissipad || Bissiphoneos || Bismidp || Bisuc7 || Bisuc || Bisandroid || Bisce || Biswm) {window.location.href = "3g.php"; } </script>Beispiel 2: Der Code ist ordentlich und viele Funktionen basieren auf dieser zusätzlichen Funktion.
<Script> var pc_style = "" 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 ('Apple, (u.Indexof) (' Applexof ('Apple, u. iNdexof (' Apple, u.Indexof ('u.Indexof (' u. idexof ('Apple, u., u.Indexof (' u.Indexof ('Apple, u.Indexof (' u. idexof ('u. idexof (' Apple, u. u.Indexof ('Gecko')> -1 && u.Indexof ('khtml') == -1, mobil: !! u.match (/applewebkit.* mobile.*/) || ! U.Intexof ('Linux')> -1, iPhone: U.Intexof ('iPhone')> -1 || U.Indexof ('Mac')> -1, iPad: u.Indexof ('iPad')> -1, webapp: u.Intexof ('safari) == -1, ua: u}; navigator.language) .tolowerCase ()} if (browser.version.mobile &&! browser.version.ipad) {this.location = "Geben Sie die Homepage -Adresse des Sprung -Mikrostation hier ein";} </script>Beispiel 3: Einige Funktionen wurden hinzugefügt
<!-Smartphone-Beurteilung Start-> <!-<script type = "text/javaScript" Sprache = "javaScript"> Funktion.Prototype.bind = Funktion (Bindobj, args) {var _self = this; return function () {return _self.Apply (Bindobj, [] .Concat (args)) {id? document.getElementById(id) : id;};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('AppleWebKit') > -1,gecko : u.Indexof ('Gecko')> -1 && u.Indexof ('khtml') == -1, mobil: !! u.match (/applewebkit.* mobile.*/) || !! U.Match (/Applewebkit/), iOS: !! U.Match (// (i [^;]+; (u;)? U.Indexof ('iPad')> -1, WebApp: u.Indexof ('safari) == -1, qqbrw: u.Indexof (' mqqbrowser ')> -1, uclowend: u.Indexof (' ucweb7. ')> -1, ucspecial: u.Indexof (' ucweb7. {return parseFloat(u.match(/ucweb/d+/./d+/gi).toString().match(//d+/./d+/).toString()) >= 8.2} catch (e) {if (u.indexOf('UC') > -1) {return true;} else {return false;}}}(),Symbian : U.Intexof ('Symbian')> -1, UCSB: U.Intexof ('Firefox/1.')> -1};} ()} var _gaq = _gaq || []; rf.tolocalelowerCase (). Indexof (". xiu.com") === -1) {var defaultJumpdomain = ""; if (defaultjumpdomain == "www") {return;} if (defaultjumpdomain == "m") {fownocation.href = "http:/wap. (screen == undefined || screen.width <810) {if (browser.version.ipad == true) {return;} if (browser.version.webkit == true || browser.version.mobile == true || browser.ios == true || browsers.iversions.iPhone. ||. </script>-> <!-Smartphone-Beurteilung enden->Beispiel 4: Empfohlen, die einfache Wulin.com zu verwenden. Wenn Sie einen besseren Code haben, können Sie ihn teilen.
<script type = "text/javaScript"> var browser = {Versionen: function () {var u = navigator.useragent, app = navigator.appversion; return {trident: u.Indexof ('trident')> -1, pResto: u.Indexof ('presto'> -1, webkit: u. u.Indexof ('Gecko')> -1 && u.Indexof ('khtml') == -1, mobil: !! u.match (/applewebkit.* mobile.*/) || !! U.Match (/Applewebkit/), iOS: !! U.Match (// (i [^;]+; (u;)? U.Indexof ('iPad')> -1, WebApp: U.Indexof ('safari) == -1, qqbrw: u.Indexof (' mqqbrowser ')> -1, weixin: u.Indexof (' micromessenger ')> -1, uclowend: u.Indexof (' ucweb7. '), ucspecial: ucweb7. u.indexOf('rv:1.2.3.4') > -1,ucweb : function () {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;} else {return false;}}} (), symbian: u.Indexof ('symbian')> -1, ucsb: u.Indexof ('firefox/1.')> -1};} (), liulanqi: navigator.useragent} if (browser.version.version.qbwwwwwws.write.version.qbwwwwws.wression.qbwwwwws.Write.Write.write (qqqqbwws.qbwwws.qbwwws.wression.write.write.write.write Browser ");} else {document.write (" Andere Browser "+browser.liulanqi);} </script>