You Cannot Access the Location Object of the Parent from a Child Window (314209)



The information in this article applies to:

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

This article was previously published under Q314209

SYMPTOMS

When a child window calls a function in its parent window in Microsoft Internet Explorer 6.0, the function may not access the window.location DOM object, all of the object properties and methods may stop responding (crash), and you may receive the following error:
Variable uses an automation type not supported by JScript

CAUSE

This problem occurs because a VARIANT in Internet Explorer 6.0 was not initialized before being used internally.

RESOLUTION

To resolve this problem, obtain the latest service pack for Internet Explorer 6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

328548 How to Obtain the Latest Internet Explorer 6 Service Pack

The English-language version of this fix should have the following file attributes or later:
   Date         Time         Version       Size       File name    
   -----------------------------------------------------------
   07-Jan-2002  16:25 PM    6.00.2713.700  2,747,904  Mshtml.dll    
				

STATUS

Microsoft has confirmed that this is a problem in Microsoft Internet Explorer 6. This problem was first corrected in Internet Explorer 6 Service Pack 1.

MORE INFORMATION

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

Steps to Reproduce the Problem

  1. Click Start, point to Programs, click Accessories, and then click Notepad.
  2. Copy and paste the following code, and then save it as "Parent.htm" (without quotation marks):
    <HTML>
    <HEAD>
    <title>Parent Window</title>
    <script>
    function accessProp()
    {
      alert(location.protocol);
      alert(location.host);
      alert(location.hash);
      alert(location.href);
      alert(location.pathname);
      alert(location.port);
      alert(location.search);
      alert(location.hostname);
     
    }
    function accessFunc()
    {
      location.reload(true);
      location.assign("http://www.microsoft.com");
      location.replace("http://msdn.microsoft.com");
      location.toString()
    }
    </script>
    </HEAD>
     
    <BODY>
    <button onclick="window.open('child.htm', 'newwin', 'width=700,height=500')">Open a child window</button>
    </BODY>
    </HTML>
    					
  3. Click Start, point to Programs, click Accessories, and then click Notepad.
  4. Copy and paste the following code, and then save it as "Child.htm" (without quotation marks):
    <html>
    <head>
    <title>Child Window</title>
    </head>
    <body>
    <p>
    <center>
    <button onclick="window.opener.accessProp()">Get all the location properties from parent</button>
    <button onclick="window.opener.accessFunc()">Get all the location methods from parent</button>
    </center>
    </p>
    </body>
    </html>
    					
  5. Place parent.htm on your Webserver and access it from the Browser through http as follows:

    http://localhost/parent.htm

  6. Click Open a child window, and the child.htm page will open in a new Internet Explorer window.
  7. Click Get all the location properties from parent or Get all the location methods from parent in the child.htm page, and you will receive the error message that is mentioned in the "Symptoms" section of this article.
This hotfix only works with versions of Internet Explorer 6.0 in which version of the Mshtml.dll file is lower than 6.00.2713.700. This hotfix is included in the February 11, 2000 cumulative security patch for Internet Explorer and later cumulative security patches. For additional information about the February 11, 2000 cumulative security patch for Internet Explorer, click the article number below to view the article in the Microsoft Knowledge Base:

316059 MS02-005: February 11, 2002, Cumulative Patch for Internet Explorer


Modification Type:MajorLast Reviewed:5/11/2006
Keywords:kbHotfixServer kbQFE kbbug kbfix kbIE600preSP1fix kbIE600sp1fix KB314209