It isn't possible to prevent reloading the page, but it is possible to help avoid the page being refreshed:
Code:
<body onunload='window.close();'> // will close window on leaving page or reloading
Be aware that the user will probably be prompted about whether or not they wish to close the window, and if someone clicks on a link the page will close.
There aren't any very efficient ways of doing what you want.
You can use onbeforeunload (non-standard, but supported by a number of browsers). Its best use is in web applications where by going back/reloading, the user will lose all their unsaved work.
Comment