Article ID: 314209 - Last Review: February 12, 2007 - Revision: 5.4

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

This article was previously published under Q314209

On This Page

Expand all | Collapse all

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  (http://support.microsoft.com/kb/328548/EN-US/ ) 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:
http://msdn2.microsoft.com/en-us/ie/default.aspx (http://msdn2.microsoft.com/en-us/ie/default.aspx)

http://support.microsoft.com/iep (http://support.microsoft.com/iep)

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  (http://support.microsoft.com/kb/316059/EN-US/ ) MS02-005: February 11, 2002, Cumulative Patch for Internet Explorer

APPLIES TO
  • Microsoft Internet Explorer 6.0, when used with:
    • Microsoft Windows XP Home Edition
    • Microsoft Windows XP Professional
    • Microsoft Windows XP Media Center Edition
    • Microsoft Windows XP Tablet PC Edition
    • Microsoft Windows 2000 Advanced Server
    • Microsoft Windows 2000 Datacenter Server
    • Microsoft Windows 2000 Professional Edition
    • Microsoft Windows 2000 Server
    • Microsoft Windows NT Server 4.0 Standard Edition
    • Microsoft Windows NT Server 4.0, Terminal Server Edition
    • Microsoft Windows NT Workstation 4.0 Developer Edition
    • Microsoft Windows Millennium Edition
    • Microsoft Windows 98 Second Edition
Keywords: 
kbbug kbfix kbqfe kbie600presp1fix kbie600sp1fix kbhotfixserver KB314209
 

Article Translations