JS determines whether it is a PC browser or a mobile device browser, jspc
<Script> $ (function () {var sUserAgent = navigator. 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"; document. writeln ("your browsing device is:"); if (bIsIpad | bIsIphoneOs | bIsMidp | bIsUc7 | bIsUc | bIsAndroid | bIsCE | bIsWM) {document. writeln ("phone");} else {document. writeln ("pc") ;}}); </script>
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.