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

New standard 2018-now (PerformanceNavigationTiming) window.performance.navigation property is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. PerformanceNavigationTiming.type This is an experimental technology. Check the Browser compatibility table carefully before using this in production. Check if page gets reloaded or refreshed in JavaScript const pageAccessedByReload = ( (window.performance.navigation && window.performance.navigation.type === … Read more

tech