I want to disable refresh on my website. Is there any way to disable F5, Ctrl-R, or reload in a webpage?
window.onbeforeunload = function () {return false;}
This disables leaving the page unless the user confirms, not only refresh, so you'll have to code this yourself to get it to work.
You never said what you were doing with it so I left it at that.
No, there is no way to disable it.
If you are trying to avoid the "Do you want to submit this action again?" dialog, use Post/Redirect/Get.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With