could someone please help in preventing page refresh from the browser, disabling f5 is not a robust solution because the user can refresh it from the browser directly, so I want to have some other way to prevent browser refresh like most of the bank sites have.
Asked
Active
Viewed 1,364 times
-1
-
Possible duplicate of [Can I disable browser refresh in my webapp?](https://stackoverflow.com/questions/5711815/can-i-disable-browser-refresh-in-my-webapp) – Alexei Levenkov Mar 13 '19 at 06:55
2 Answers
2
A better way to know that the page is actually reloaded is to use the navigator object that is supported by most modern browsers.
Below code may help you,
It uses the Navigation Timing API.
//check for Navigation Timing API support
if (window.performance) {
console.info("window.performance works fine on this browser");
}
if (performance.navigation.type == 1) {
console.info( "This page is reloaded" );
} else {
console.info( "This page is not reloaded");
}

Manesh N Pawar
- 21
- 2
-
Hi Manesh, thanks for your response but this is not a good approach as it refreshes the page first then it detects its refresh or not. – Lucky Mar 13 '19 at 07:33
0
Disabling Ctrl + F5 and F5 is possible, but disabling the refresh button on the browser is impossible.
You can refer on this forum . I hope this can help you clarify things.

Florenz
- 53
- 6
-
Hi Florenz, I agree with your statement but there must be some way around because all bank sites are blocking their refresh of browsers – Lucky Mar 13 '19 at 07:34
-