Any Javascript Event Occurring When User Clicks Stop Load Button?
Solution 1:
Internet Explorer has a document.onstop
event that is fired, but other browsers don't seem to support that. Note that it's fired when the user clicks Stop or hits Esc, OR if the user navigates to another page during page load, which has the same effect.
I don't believe there is a reliable way to trigger an event on clicking Stop in other browsers. Perhaps it would be possible to do something like: keeping the connection to the server open (as in the Comet approach), streaming some sort of keep-alive down the connection, and detecting if the stream ends (as I assume it would if the Stop button were clicked).
Solution 2:
If it's images that are still getting loaded on the page, you can use the onabort
event to monitor for the stop load.
Monitoring for the mouse click should be impossible, as it doesn't happen inside the current browsing window.
Solution 3:
There isn't any cross browser way of doing this.
However, IE has a special event, onstop
which occurs on the body
when the stop button is pressed. You cannot override the stop button functionality (that is, you cannot cancel it), but you can detect that it has happened in IE.
Post a Comment for "Any Javascript Event Occurring When User Clicks Stop Load Button?"