A recently-made web page needs to display different page styles depending on the user's access to the device, primarily to determine whether a mobile device or a computer browser is accessing it.
The following gives the JS judgment processing code, for reference.
<script type= "Text/javascript" >functionBrowserredirect () {varSuseragent =navigator.userAgent.toLowerCase (); varBisipad = Suseragent.match (/ipad/i) = = "ipad"; varBisiphoneos = Suseragent.match (/iphone os/i) = = "iphone OS"; varBISMIDP = Suseragent.match (/midp/i) = = "MIDP"; varBIsUc7 = Suseragent.match (/rv:1.2.3.4/i) = = "rv:1.2.3.4"; varBISUC = Suseragent.match (/ucweb/i) = = "UCWeb"; varBisandroid = Suseragent.match (/android/i) = = "Android"; varBisce = Suseragent.match (/windows ce/i) = = "Windows CE"; varBISWM = Suseragent.match (/windows mobile/i) = = "Windows Mobile"; Document.writeln ("Your browsing device is:"); if(Bisipad | | bisiphoneos | | bismidp | | bIsUc7 | | bisuc | | bisandroid | | bisce | |biswm) {Document.writeln ("Phone"); } Else{Document.writeln ("PC"); }} browserredirect ();</script>
JS to determine whether the user's browser device is mobile or PC-side