Article ID: 811577 - Last Review: January 26, 2004 - Revision: 4.0

The onload event handler does not fire when you return to a page

On This Page

Expand all | Collapse all

SYMPTOMS

When you follow a link in a frameset that targets the top frame, and then you go back to the page where you started, the onload event handler does not fire.

RESOLUTION

To resolve this problem, add an onunload event handler. This turns on the onload event handler so that it will fire (although how it does this is not known).

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.

MORE INFORMATION

Steps to reproduce the behavior

  1. Save frame.htm and test.htm to a Web server.

    frame.htm
    <html>
    <frameset rows="*,*">
    <frame src="test.htm">
    </frameset>
    </html>
    
    test.htm
    <HTML>
    <HEAD>
    <SCRIPT language='JavaScript'>
    function testMessage()
    {
        alert("onload");
    }
    </SCRIPT>
    </HEAD>
    <BODY onload="testMessage()">
    <a href="http://www.microsoft.com" target="_top">test</a><br>
    </BODY>
    </HTML>
    
  2. Use Microsoft Internet Explorer for Macintosh to view frame.htm. A dialog box appears that indicates that the onload event handler for the frame has fired.
  3. Click the link to view another Web page in the top frame.
  4. Click the Back button. The onload event handler does not fire.
  5. If you add the following onunload event handler, the problem does not occur.
    <BODY onload="testMessage()" onunload="">

APPLIES TO
  • Microsoft Internet Explorer 5.2 for Mac OS X
  • Microsoft Internet Explorer 5.1 for Macintosh
Keywords: 
kbhtml kbdhtml kbbug KB811577
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
 

Article Translations

 

Related Support Centers