directly on the code
var Appcommon = {
downappurl: "http://**/",//download app address
downweixin: "http://**",//download app address
iphoneschema: ' openapp.jdmobile://',//ios Open app jump address (this jump address needs to be provided by iOS developers)
Iphonedownurl: ' https://** ',//ios
androidschema: ' openapp.jdmobile://',//Android Open app jump address (this jump address needs Android Developer offers )
androiddownurl: ' http://**/',// Android
openapp:function () {
var this_ = this;
if (This_.isweixin ()) {//
window.location = this_.downweixin;
}
}else{//non-browser
if (Navigator.userAgent.match (/(Iphone|ipod|ipad);? /i)) {
var loaddatetime = new Date ();
window.settimeout (function () {
var timeoutdatetime = new Date ();
if (loaddatetime && Timeoutdatetime-loaddatetime < (+ +)) {
window.location = This_.iphonedownurl;//ios
} else {
window.close ();
}
},1600); Time to be determined here
window.location = This_.iphoneschema;
}else if (Navigator.userAgent.match (/android/i)) {
var loaddatetime = new Date ();
var ifrsrc =this_.androidschema;
if (!ifrsrc) {
return;
}
var IFR = document.createelement (' iframe ');
ifr.src = ifrsrc;
ifr.style.display = ' none ';
Document.body.appendChild (IFR);
var timeload = setTimeout (function () {
Document.body.removeChild (IFR);
Window.location=this_.androiddownurl;//android
}, ();
window.onblur=function () {
cleartimeout (timeload);
};
}else{//Non-iOS, non- Android
window.location = This_.downappurl;
}
}
},
isweixin:function () {//Determine if it is
var ua = Navigator.userAgent.toLowerCase ();
if (ua.match (/micromessenger/i) = = "Micromessenger") {
return true;
} else {
return false;
}
}
};
function Openap () {
Appcommon.openapp ()
}
Preparation:
1, after testing the iOS with an iframe to try to open the app is not feasible, so a change of thinking, with response time to control.
2. iOS install app comes with browser Safari will have the alert box, there is no workaround to find the mask.
3, prohibit the opening of the app this feature, so the recommended jump address for the app Bao.
JS open App (skip download page not installed)