I have a small website that has jQuery on its side.
I have a page where I need to perform some AJAX action before the page is unloaded, but this action may not work if a certain button was pressed.
I tried to do this:
<body onbeforeunload="myaction();">
But how do you know if a button is pressed?
Mihai source share