I have a content management page on my CMS on which I have a popup that warns the user on page close. It is a very simple warning implemented like so:
window.onbeforeunload = function (e) {
return 'Are you sure you want to close?';
}
It works, but the problem is that the popup is shown even when the user clicks the same button. I am very new to document events so I have no idea how to do this, but I want the popup to only show when the page is being closed and not when it is being posted back.
Also I have not used JQuery in my website so please don't suggest it; I don't want to use a whole framework just for a popup. . Thanks.