一、解决window.close失效问题
function f_close(){
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();
}
}
二、针对个人问题,IOS手机和安卓手机都能关闭(两个的前后顺序不能调换)
setTimeout(function(){
document.addEventListener('WeixinJSBridgeReady', function(){ WeixinJSBridge.call('closeWindow'); }, false);
WeixinJSBridge.call('closeWindow');
}, 1000)