I have been trying to implement a functionality when the page refreshes. I figured that value of
window.performance.navigation.type
turns 1 if the page reloads else, it is 0. I created an alert message on page load and the values are correct for IE and Firefox but it remains "0" for Chrome throughout no matter how many times the page reloads. I have also tried windows.onbeforeunload as per other stackoverflow answers but nothing seems to work!
How do I resolve this?
OR
Is there another way to detect a page reload that works on all the browsers?
Thanks!
According to the docs, the Performance.navigation
property returns a PerformanceNavigation
object.
Checking the browsers compatibility at the bottom of the page you can see that chrome is not supported.