I want to check when someone tries to refresh a page.
For example, when I open a page nothing happens but when I refresh the page it should display an alert.
I found some information here Javascript Detecting Page Refresh
function UnLoadWindow() { return 'We strongly recommends NOT closing this window yet.' } window.onbeforeunload = UnLoadWindow;