JS to determine whether the mobile phone or pad access implementation method
s to determine whether the mobile phone or pad access content, for the use of JS to determine whether the mobile phone or pad visit interested students can see,
Directly on the code:
<script type= "Text/javascript" > * * Smart Browser version information: * */var browser={versions:function () {var u = navigator.u
Seragent, app = Navigator.appversion; return {//Mobile terminal browser version information Trident:u.indexof (' Trident ') >-1,//ie kernel presto:u.indexof (' presto ') >-1,//ope RA kernel webkit:u.indexof (' AppleWebKit ') >-1,//Apple, Google kernel gecko:u.indexof (' Gecko ') >-1 && U.indexo F (' khtml ') = = 1,//Firefox kernel Mobile:!! U.match (/applewebkit.*mobile.*/) | | U.indexof (' IPad ') >-1,//Whether for Mobile terminal iOS:!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/),//ios terminal Android:u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1,//android terminal or UC Browser iphone:u.indexof (' IPhone ') >-1,//whether for IPhone or Qqhd browser iPad:
U.indexof (' ipad ') >-1,//whether the ipad webapp:u.indexof (' Safari ') = = 1//Whether the Web should program, no head and bottom}; } (), Language: (Navigator.browserlanguage | | Navigator.language. toLowerCase ()} document.writeln ("language version: +browser.language+" <br/>");
Document.writeln ("Whether for Mobile Terminal:" +browser.versions.mobile+ "<br/>");
Document.writeln ("iOS Terminal:" +browser.versions.ios+ "<br/>");
Document.writeln ("Android Terminal:" +browser.versions.android+ "<br/>");
Document.writeln ("Whether for IPhone:" +browser.versions.iphone+ "<br/>");
Document.writeln ("Whether the IPad:" +browser.versions.ipad+ "<br/>");
Document.writeln (navigator.useragent); </script>
Thank you for reading, I hope to help you, thank you for your support for this site!