Can I disable browser refresh in my webapp?

kiran picture kiran · Apr 19, 2011 · Viewed 51.4k times · Source

I want to disable refresh on my website. Is there any way to disable F5, Ctrl-R, or reload in a webpage?

Answer

Wesley Murch picture Wesley Murch · Apr 19, 2011
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.