if (window.history && window.history.pushState) {
window.addEventListener("popstate", function(e) {
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if (hashName !== '') {
var hash = window.location.hash;
if (hash === '') {
alert("Back button");
}
}
}, false);
window.history.pushState(null, null, '#forward');
alert(window.location.href)
}
請問下有人遇過這問題嗎?window.history.pushState() 在百度APP打開的頁面沒有效果,并沒有寫進去history(有時候會突然可以寫進去) 有什么解決辦法嗎?
uj5u.com熱心網友回復:
沒人遇過這問題嗎,就是window.history.pushState()沒有執行,JS代碼到pushState就停止了,本來是以為可能是APP使用webview打開的緣故,可是有時候又突然可以執行了。(主要在百度APP遇到的問題)請大佬幫忙看看轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/119592.html
標籤:JavaScript
上一篇:學校資訊門戶問題
