[英]Firefox not firing popstate event on forward
使用History API處理ajax頁面。 並且卡在Firefox沒有觸發“popstate”事件的地步:
這是訪問流程(URL):
1. Started from Home Page (/) 2. Visited About Us (/about-us) 3. Clicked Back Button to go on Home Page (/) 4. Refreshed the page using F5 5. Clicked Forward button to go on (/about-us) # Here firefox not firing "popstate" but Chrome is
劇本:
$(window).on("popstate", function (e) {
var data = window.history.state;
console.log("State Data:");
console.log(data);
popped_first = true;
...
});
使用pushState喚醒它。
history.pushState({}, '');
window.onpopstate = function() {
alert(1);
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.