if (window.history && window.history.pushState) {
var data = {rand: Math.random()};
window.history.pushState(data, '', '');
$(window).on('popstate', function() {
window.location.href = window.location.href;
history.go(-1);
//location.reload();
});
}
我使用上面的代碼重新加載瀏覽器後面的按鈕頁面按鈕,但它不工作在mozilla中...也禁用從鉻的前進按鈕...有什麼辦法重新加載前一頁沒有硬編碼的網址? ?? 感謝您的幫助什麼是history.go(-1);在mozilla
嘗試'window.history.go(-1)' –
也刪除此行:'window.location.href = window.location.href;'因爲它可能會重新加載頁面。 –
'history.back()'...怎麼樣? –