This problem occurs today. IE6 uses innerhtml to dynamically insert images in window. onload. As a result, these images ignore the local cache policy and send n more than 304 requests.
As a result, I used another method. Instead of using IMG in innerhtml, I used CSS styles in the newly added HTML Tag of innerhtml to Import images. However, the problem persists. IE6 still sent 304 requests.
I found an emu blog on the Internet and said that IMG created by innerhtml ignores the local cache. The sample code is as follows. Is it true that the IMG created by innerhtml ignores the cache? Not necessarily!
<HTML>
<Body>
<Div id = "DD"> </div>
</Body>
<SCRIPT type = "text/JavaScript">...
VaR A = new array (101 );
VaR S = " <br/> ";
Window. onload = function ()
...{
Document. getelementbyid ("DD"). innerhtml = A. Join (s );
}
</SCRIPT>
</Html>
When running the above Code, monitoring HTTP requests is indeed sending 304 requests, but in my mztreeview, I also used innerhtml to create a large number of and did not find that the local cache is invalid, the root cause is not in innerhtml, but in window. onload. Change the same code to the following code and try again:
<HTML>
<Body>
<Div id = "DD"> </div>
</Body>
<SCRIPT type = "text/JavaScript">...
VaR A = new array (101 );
VaR S = " <br/> ";
Document. getelementbyid ("DD"). innerhtml = A. Join (s );
</SCRIPT>
</Html>
Use the HTTP request monitoring software!
IE6 does have a dynamically created IMG bug that ignores local cache, but this bug is not in innerhtml but in window. onload. This bug has been fixed in IE7.
Bug fixes:
First, put the script in the back and run it directly as in the above example;
Second, use setTimeout to delay execution in window. onload.