You are here: Reference > JavaScript > client-side > event handling > events > onstop

onstop event | stop event

Browser support:
Occurs when the user aborts the loading of the document.
If an onstop event occurs, the onload event is not fired on the document.

How to register:

In HTML:
This event cannot be registered in HTML.

In JavaScript:
object.onstop = handler;
object.addEventListener ("stop", handler, useCapture);
9
object.attachEvent ("onstop", handler);
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript.

Basic information:

Bubbles No
Cancelable No
Event object Event

Actions that invoke the onstop event:

  • Clicking on the browser's STOP button or pressing ESC while the page is loading.
  • Navigating to another page while the page is loading.

The order of events related to the onstop event:

Action Event order
Clicking on the browser's STOP button or pressing ESC while the page is loading. 1. onstop
Navigating to another page while the page is loading.
Internet Explorer Firefox, Opera, Google Chrome, Safari
  1. onbeforeunload
  2. onstop
  3. onunload
  1. onbeforeunload
  2. onunload

Example HTML code 1:

This example illustrates the use of the onstop event:
<head>
    <script type="text/javascript">
        document.onstop = OnStopDocument;
        function OnStopDocument () {
            alert ("The loading of the document has been aborted.");
        }
        function OnLoadDocument () {
            alert ("The document has been loaded.");
        }
    </script>
</head>
<body onload="OnLoadDocument ()">
    Press the Escape key to abort the loading process.
    <img src="large.bmp" width="200px" height="150px" />
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content