Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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);

↑ Back to the top


Keywords: KB948550, kbprb, kbtshoot, kbwebbrowser, kbcode

↑ Back to the top

Article Info
Article ID : 948550
Revision : 1
Created on : 3/4/2008
Published on : 3/4/2008
Exists online : False
Views : 354