<script>
pushHistory();
//監聽觸發物理返回按鈕
window.addEventListener("popstate", function(e) {
f_close();//執行關閉瀏覽器窗口,返回公眾號首頁
return;
}, false);
function pushHistory() {
var state = {
title: "title",
url: "#"
};
window.history.pushState(state, "title", "#");
}
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();
}
}
}
</script>
<script>
pushHistory();
//監聽觸發物理返回按鈕
window.addEventListener("popstate", function(e) {
f_close();//執行關閉瀏覽器窗口,返回公眾號首頁
return;
}, false);
function pushHistory() {
var state = {
title: "title",
url: "#"
};
window.history.pushState(state, "title", "#");
}
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();
}
}
}
</script>
