
How can I detect if a user clicks the browser's Stop button while viewing my Web page? Starting with Microsoft® Internet Explorer 5.0, your client-side code can trap the onstop event. This will let you know when the user clicks the Stop button, hits the Escape key, or when the page is being unloaded. Trapping the onstop event is handy when your page is performing some process that you want to stop when the user clicks the Stop button. Some processes that users might want to stop include background music, some forms of animation, some image loading, or other lengthy processes. The code in Figure 1 shows how to trap the onstop event.
|