Recently made a version of the promotion page, through the JQ to determine the device, and download
Built-in browser to the download link is masked, so first judge, if it is built-in browser, then jump to the app Bao link, if not, then judge is iphone/adroid/pc and jump
The code is as follows:
function Downloadapp () {var u = navigator.useragent; var ua = Navigator.userAgent.toLowerCase (); var isandroid = u.indexof (' Android ') >-1 | | U.indexof (' Adr ') >-1; Android terminal var Isios =!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/); iOS terminal if (ua.match (/micromessenger/i) = = "Micromessenger") { //built-in browser $ (". Download a"). Click (function () { window.location.href= ' http://a.app.qq.com/o/simple.jsp?pkgname= application Name '}); }else{if (Isios) {$ (". Download a"). Click (function () {window.location.href= ' https://itunes.apple.com/cn/app/application Name '});} else if (isandroid) {$ (". Download a"). Click (function () {window.location.href= ' http://a.app.qq.com/o/simple.jsp? Pkgname= application Name '}); else{$ (". Download a"). Click (function () {window.location.href= ' app link '});}} }
Just finishing, there may be errors, need to be updated.
JQ realizes iphone, Android device