vipback.js
1.11 KB
//app点击返回按钮调用该函数
function vipback(){
var s = mUrl.getApporWX();
console.log("调用返回函数 "+s);
if(s=='android'){
JSInterface.Vback();
}else if(s=='ios'){
window.webkit.messageHandlers.Vback.postMessage(null);
}else if(s=='wx'){
var src = document.referrer;
if(src&&src.length>5){
window.history.go(-1);
}else{
if(typeof(WeixinJSBridge)!="undefined"){
WeixinJSBridge.call('closeWindow');
}else{
if (navigator.userAgent.indexOf("MSIE") > 0) {
if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
window.opener = null; window.close();
}
else {
window.open('', '_top'); window.top.close();
}
}
else if (navigator.userAgent.indexOf("Firefox") > 0) {
window.location.href = 'about:blank ';
}
else {
window.opener = null;
window.open('', '_self', '');
window.close();
}
}
}
}
}