Reload Page On Browser Back Button Click

Utility
JS
  • In most browsers, pressing the back button pulls up the previous state of the last page instead of refreshing the last page. In cases where this may break interactions or intended functionality, we can force the browser to refresh the page.
<script> 
window.onpageshow = function(event) {
	if (event.persisted) window.location.reload();
};
</script>
Last Updated: Dec 4, 2025
  • In most browsers, pressing the back button pulls up the previous state of the last page instead of refreshing the last page. In cases where this may break interactions or intended functionality, we can force the browser to refresh the page.
<script> 
window.onpageshow = function(event) {
	if (event.persisted) window.location.reload();
};
</script>