Steps to Reproduce the Behavior
There are two ways to cause Internet Explorer to hang:
- If the cause of the problem is a SCRIPT tag with a src attribute, then you can avoid the problem if you add Hypertext Transfer Protocol (HTTP) headers that make sure that the browser does not request the script file for some predetermined period of time. For example, in Internet Information Server (IIS) you can set the content expiration so that the script file expires at a time in the future, such as in a day. See the "References" section for additional information.
- Another way to cause Internet Explorer to hang is to send the script file with Expires and Cache-control: max-age HTTP headers.
In this example, the max-age value of 86400 seconds means the file may be kept in a cache for about a day.
Expires: (date)
Cache-control: max-age=86400
If the cause of the problem is an
XML tag with a
src attribute, you can avoid the problem if you modify the HTML Control (HTC) so that the XML data island is inserted dynamically as shown in the following code sample:
testDiv.insertAdjacentHTML("afterEnd", "<xml src=\"Inner.xml\"/>");
The following code sample illustrates both causes. You create five files in the following sample. If you use this sample, you must apply both workarounds together.
- Create the Sample.htm file:
<HTML xmlns:ctrl>
<HEAD>
<?import namespace="ctrl" implementation="outer.htc">
<TITLE>Sample Q319738</TITLE>
</HEAD>
<BODY>
<ctrl:outer></ctrl:outer>
</BODY>
</HTML>
- Create the Outer.htc file:
<html xmlns:ctrl>
<?import namespace="ctrl" implementation="inner.htc" />
<head>
<public:component tagName="outer">
<public:defaults viewLinkContent="true" />
<public:attach event=oncontentready onevent="DoElementInsert()" />
</public:component>
<script language="JavaScript">
function DoElementInsert()
{
idDiv.innerHTML = "<ctrl:inner/>";
}
</script>
</head>
<body style="border: darkgray 2px solid; background-color:lightgrey; padding=5px;">
This is the outer element behavior. <br>
<div id="idDiv" style="BACKGROUND-COLOR: white">
Text in this DIV gets replaced.
</div>
</body>
</html>
- Create the Inner.htc file:
<html>
<head>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<public:component tagName="inner">
<public:defaults viewLinkContent="true" />
</public:component>
<!-- this script tag will cause a hang if the browser is requesting pages on every visit to the page. -->
<script language="javascript" src="inner.js" ></script>
</head>
<body>
<div style="border: 1px solid darkgrey; background-color: lavender; padding: 5px;"
id="testDiv">
This is the inner element behavior.
</div>
<!-- This XML tag will cause a hang unless it is inserted dynamically -->
<xml src="inner.xml"/>
</body>
</html>
- Create the Inner.js file:
function doNothing() {
// Do nothing.
}
- Create the Inner.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<anytag>
Any XML will do.
</anytag>
- Save all of these files on an HTTP server.
- Start Internet Explorer and explore to the Sample.htm page. For example, explore to http://localhost/Q319738/Sample.htm.
After you complete the preceding steps, you can see the behavior.
If you follow the preceding steps, but you cannot reproduce the behavior, check the following :
- Verify that the page is accessed through HTTP protocol (http://). If you access the file from file protocol (file://) you may not be able to reproduce the behavior.
- Verify that the caching setting for Internet Explorer is set to Every visit to the page.
- To confirm this setting, on the Tools menu, click Internet Options.
- From the General tab, click Settings in the Temporary Internet Files panel.
- In the Settings dialog box, click to select Every visit to the page in the Check for newer versions of stored pages check box.
- Verify that all five files that you created are located in the same virtual directory.