1

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?

Tobia
  • 9,165
  • 28
  • 114
  • 219
  • 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 Answers1

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