I have a page with Paypal payment link, my page use a location.href to redirect user to payment page. But, if he abort the page with browser stop button, I would like to show a message with a link. How can I get the page load stop event?
Asked
Active
Viewed 262 times
1
-
Does this answer your question? [Any Javascript event occurring when user clicks Stop load button?](https://stackoverflow.com/questions/7728158/any-javascript-event-occurring-when-user-clicks-stop-load-button) – JamesTheAwesomeDude Feb 23 '23 at 16:31
1 Answers
0
You can use document.onstop
Occurs when the user aborts the loading of the document. If an onstop event occurs, the onload event is not fired on the document.
document.onstop = OnStopDocument;
function OnStopDocument () {
alert ("The loading of the document has been aborted.");
}
function OnLoadDocument () {
alert ("The document has been loaded.");
}
<body onload="OnLoadDocument ()">
Loading the document
</body>

Oyeme
- 11,088
- 4
- 42
- 65
-
Should this work on the caller page? `document.onstop` is not working on caller page – Tobia Mar 20 '19 at 13:53
-