Microsoft Knowledge Base Email Alertz

A script may not run as expected in Windows Internet Explorer when you open an HTML page and the HTML page contains an element that has injected HTML code

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 948550 - Last Review: March 4, 2008 - Revision: 1.0

A script may not run as expected in Windows Internet Explorer when you open an HTML page and the HTML page contains an element that has injected HTML code

SYMPTOMS

When you use Windows Internet Explorer to open an HTML Web page and the Web page contains an element that has injected HTML code, the script may not run as expected. This problem occurs if the following conditions are true:
  • The element is not included in the markup tree.
  • Active scripting is disabled in the Internet zone.
  • The site is added to the Trusted Sites zone.

CAUSE

This issue occurs because Internet Explorer sets the security of an element as "about:blank" if the following conditions are true:
  • A Web page inserts code into the element.
  • The element is not included in the markup tree.

RESOLUTION

To resolve this issue, make sure that the element is included in the markup tree. When you do this, the element obtains the security from the current page. To do this, call the innerHTML property before you call the element in the script.

MORE INFORMATION

The following code example illustrates how to include the element inside the markup tree.
treeDiv = srcDoc.createElement("DIV");
treeDiv.id = "treeDiv";
treeDiv.className = "treeDiv";
treeDiv.style.pixelTop = 0;
scrollDiv.appendChild(treeDiv);
treeDiv.onresize = treeResize;
treeDiv.innerHTML = loadTree(treeXML);

APPLIES TO
  • Windows Internet Explorer 7
  • Microsoft Internet Explorer 6.0
  • Microsoft Internet Explorer 5.5
  • Microsoft Internet Explorer 5.0
Keywords: 
kbcode kbwebbrowser kbtshoot kbprb KB948550
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate