When the user scans a QR code with a mobile device, it links the scanned link to a page that contains only the JS that determines the mobile terminal, and automatically jumps to the corresponding link or downloads the corresponding content after judging it.
The HTML code is as follows:
1 <Script>2 varBrowser= {3 Versions:function() {4 varu=navigator.useragent, App=navigator.appversion;5 return {//Mobile Terminal browser version information6 Trident:u.indexof ('Trident') > -1, //IE kernel7 Presto:u.indexof ('Presto') > -1, //Opera Kernel8 Webkit:u.indexof ('AppleWebKit') > -1, //Apple, Google kernel9 Gecko:u.indexof ('Gecko') > -1 &&U.indexof ('khtml') == -1, //Firefox kernelTen Mobile:!!U.match (/applewebkit.*mobile.*/) || !!U.match (/AppleWebKit/), //whether it is a mobile terminal One iOS:!!U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS X/), //iOS terminal A Android:u.indexof ('Android') > -1 ||U.indexof ('Linux') > -1, //Android Terminal or UC browser - Iphone:u.indexof ('IPhone') > -1 ||U.indexof ('Mac') > -1, //whether it's an iphone or Qqhd browser - Ipad:u.indexof ('IPad') > -1, //whether ipad the Webapp:u.indexof ('Safari') == -1 //whether the web should program, no head with the bottom - }; - }(), - language: (Navigator.browserlanguage||navigator.language). toLowerCase () + } - + if(Browser.versions.ios||Browser.versions.iPhone||browser.versions.iPad) { A window.location="https://itunes.apple.com/us/app/hua-nan-cheng-guang-shi-chang/id900382780?l=zh&ls=1&mt=8"; at } - Else if(browser.versions.android) { - window.location="http://guangapk.csc86.com:8100/csc_guang.apk"; - } - /*Document.writeln ("language version:" + browser.language); - Document.writeln ("Whether for Mobile Terminal:" + browser.versions.mobile); in Document.writeln ("iOS terminal:" + Browser.versions.ios); - Document.writeln ("Android Terminal:" + browser.versions.android); to Document.writeln ("Whether for IPhone:" + browser.versions.iPhone); + Document.writeln ("Whether IPad:" + browser.versions.iPad); - Document.writeln (navigator.useragent);*/ the </Script>
This article reprinted to: Http://www.cnblogs.com/pengxl/p/3476588.html
Automatic judgment of mobile terminal equipment via JS (ios\android, etc.)