The OnBeforeUnload and OnUnload Events Are Not Triggered in Internet Explorer 6 SP1 If the Body Tag Is Empty (331869)



The information in this article applies to:

  • Microsoft Internet Explorer version 6 for Windows 2000 SP1
  • Microsoft Internet Explorer version 6 for Windows 98 Second Edition SP1
  • Microsoft Internet Explorer version 6 for Windows Millennium Edition SP1
  • Microsoft Internet Explorer version 6 for Windows 98 SP1
  • Microsoft Internet Explorer version 6 for Windows NT 4.0 SP1
  • Microsoft Internet Explorer version 6 for Windows XP SP1

This article was previously published under Q331869

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

The OnBeforeUnload and OnUnload events are not triggered in Internet Explorer 6 Service Pack 1 (SP1) if the Body tag is blank. The following sample HTML code demonstrates this problem:
<HTML>
<HEAD>
<SCRIPT>
function unload()
{
	alert("unload")
}
function beforeunload()
{
	alert("beforeunload")
}
function resize()
{
	alert("resize")
}
</SCRIPT>

<SCRIPT for="window" event="onload">
window.onunload = unload;
window.onbeforeunload = beforeunload;
window.onresize = resize;	
alert("loading");
</SCRIPT>

</HEAD>
<BODY>
</BODY>
</HTML>

RESOLUTION

A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next Internet Explorer 6 service pack that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version         Size       File name
   ---------------------------------------------------------
   24-Oct-2002  15:45  6.00.2800.1132  2,788,352  Mshtml.dll

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

This hotfix adds a registry setting that is installed with the hotfix. The registry setting is:

Key = HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
Value = Q331869: REG_SZ (Set to Yes to enable the fix)

If you apply a later hotfix, security update, or service pack without installing this hotfix, you must set the registry value manually.

Modification Type:MinorLast Reviewed:10/11/2005
Keywords:kbHotfixServer kbQFE kbbug kbfix kbIE600preSP2fix kbQFE KB331869