Home > Web Front-end > JS Tutorial > body text

IE6 background image not caching problem solution and image usage strategy summary of multiple methods_javascript skills

WBOY
Release: 2016-05-16 17:53:41
Original
1436 people have browsed it

Solution one: IE6 Hack script

Copy code The code is as follows:

<script> <br>if(navigator.appName == "Microsoft Internet Explorer"){ <br>var b_version=navigator.appVersion; <br>var version=b_version.split(";"); <br>var trim_Version=version[1 ].replace(/[ ]/g,""); <br>if(trim_Version=="MSIE6.0"){ <br>;//alert("IE 6.0"); <br>try { <br>document.execCommand("BackgroundImageCache", false, fix); <br>}catch(err){ } <br>} <br>} <br></script>

Solution Method Two: IE6 Hack Comments
Copy code The code is as follows:



Solution Three: IE6 Hack Style
Copy the code The code is as follows:

html {}
{
filter:expression(document.execCommand("BackgroundImageCache", false, true)) ;
}

But the above method cannot solve the problem of using images in innerHTML without caching. For the official Microsoft explanation of this problem, please refer to: http://support.microsoft.com/ default.aspx?scid=kb;en-us;319546

Solve the problem of background image caching. The use of Web images can be defined using CSS background-image, and cache-only access is used. once. For the IMG tag, some websites use a 1-pixel GIF image (width and height) as the SRC value, indicating that the content is defined by a style class, such as:
Copy code The code is as follows:

.yahoo
{
background: url('img/yahoo.png') no-repeat;
width: 16px;
height:16px;
}


Things to consider when using images in web applications The problem is the number of image requests, the size of the image, and the clarity of the image.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template