Force Firefox to Reload Page on Back Button

2020-02-08 14:25发布

How do you make Firefox rerun javascript and reload the entire page when the user presses the back button? I was able to do this in all browsers except Firefox from the help of another SO question by adding this code:

history.navigationMode = 'compatible';
$("body").unload(function(){})

And also adding an iFrame... But this doesn't work in Firefox. Is there anything to do?

8条回答
做自己的国王
2楼-- · 2020-02-08 15:09

Add this to you file. Clean your cache first before testing.

<?php
 header("Cache-Control: private, no-store, max-age=0, no-cache, must-revalidate, post-check=0, pre-check=0");
 header("Pragma: no-cache");
 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
?>

to add headers in javascript please read this.

https://developer.mozilla.org/en-US/docs/Web/API/Headers/append

查看更多
看我几分像从前
3楼-- · 2020-02-08 15:11

add this between your HEAD tags

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
查看更多
登录 后发表回答