JS determines whether mobile phone or pad access implementation method
For S to determine whether to access mobile phone or pad, students who are interested in using JS to determine whether to access mobile phone or pad can read it.
Directly upload the code:
<script type="text/javascript"> /* * Smart browser version information: * */ var browser={ versions:function(){ var u = , app = ; return {//Mobile terminal browser version information trident: ('Trident') > -1, //IE kernel presto: ('Presto') > -1, //opera kernel webKit: ('AppleWebKit') > -1, //Apple, Google kernel gecko: ('Gecko') > -1 && ('KHTML') == -1, //Firefox core mobile: !!(/AppleWebKit.*Mobile.*/)||('iPad') > -1, //Is it a mobile terminal ios: !!(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios terminal android: ('Android') > -1 || ('Linux') > -1, //Android terminal or uc browser iPhone: ('iPhone') > -1, //Is it an iPhone or QQHD browser? iPad: ('iPad') > -1, //Is it an iPad webApp: ('Safari') == -1 //Whether the web should be a program, there is no header or bottom }; }(), language:( || ).toLowerCase() } ("Language Version: "++"<br/>"); ("Is it a mobile terminal: "++"<br/>"); ("ios terminal: "++"<br/>"); ("android terminal: "++"<br/>"); ("Is it an iPhone: "++"<br/>"); ("Is it iPad: "++"<br/>"); (); </script>
Thank you for reading, I hope it can help you. Thank you for your support for this site!