How to force reloading a page when using browser back button?

You can use pageshow event to handle situation when browser navigates to your page through history traversal: window.addEventListener( “pageshow”, function ( event ) { var historyTraversal = event.persisted || ( typeof window.performance != “undefined” && window.performance.navigation.type === 2 ); if ( historyTraversal ) { // Handle page restore. window.location.reload(); } }); Note that HTTP cache … Read more

Check if page gets reloaded or refreshed in JavaScript

⚠️⚠️⚠️ window.performance.navigation.type is deprecated, pls see Илья Зеленько’s answer A better way to know that the page is actually reloaded is to use the navigator object that is supported by most modern browsers. It uses the Navigation Timing API. //check for Navigation Timing API support if (window.performance) { console.info(“window.performance works fine on this browser”); } … Read more