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

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

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

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


APPLIES TO
• Windows Internet Explorer 7
• Microsoft Internet Explorer 6.0
• Microsoft Internet Explorer 5.5
• Microsoft Internet Explorer 5.0

Back to the top

Keywords: 
kbcode kbwebbrowser kbtshoot kbprb KB948550

Back to the top

 

Microsoft Knowledge Base Article

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


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image