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



The information in this article applies to:

  • Microsoft Internet Explorer 5.2.x for Macintosh
  • Microsoft Internet Explorer 5.1.x for Macintosh

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="">

Modification Type:MajorLast Reviewed:1/26/2004
Keywords:kbhtml kbDHTML kbbug KB811577 kbAudDeveloper