簡體   English   中英

Firefox沒有在前進時觸發popstate事件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM