Recently made a version of micro-letter publicity page, through the JQ to judge the device, and to download
Micro-letter built-in browser to download the link to the screen, so first to judge, if the micro-letter built-in browser, then jump to apply the treasure link, if not, the judge is iphone/adroid/pc and to 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") {//micro-letter 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= ' Apply link '
});
}
}
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.