IE6 background image no-Cache solution and multiple image usage policies

Source: Internet
Author: User

Solution 1: IE6 Hack script Copy codeThe Code is as follows: <script>
If (navigator. appName = "Microsoft Internet Explorer "){
Var B _version = navigator. appVersion;
Var version = B _version.split (";");
Var trim_Version = version [1]. replace (/[]/g ,"");
If (trim_Version = "MSIE6.0 "){
; // Alert ("Internet Explorer 6.0 ");
Try {
Document.exe cCommand ("BackgroundImageCache", false, fix );
} Catch (err ){}
}
}
</Script>

Solution 2: IE6 Hack commentCopy codeThe Code is as follows: <! -- [If IE 6]>
<Script type = "text/javascript"> <! --
Document.exe cCommand ("BackgroundImageCache", false, true );
// --> </Script>
<! [Endif] -->

Solution 3: IE6 Hack StyleCopy codeThe Code is as follows: html {}
{
Filter: expression(document.exe cCommand ("BackgroundImageCache", false, true ));
}

But the above method can not solve the problem of using images in innerHTML without caching, the problem of Microsoft official explanation reference: http://support.microsoft.com/default.aspx? Scid = kb; en-us; 319546

To solve the problem of background image caching, you can use CSS background-image for definition and cache for only one access. For IMG tags, some websites use a GIF image of 1 pixel (both width and height) as the SRC value, indicating that the content is defined by style classes, for example:Copy codeThe Code is as follows:. yahoo
{
Background: url ('img/yahoo.png ') no-repeat;
Width: 16px;
Height: 16px;
}


When using images in Web applications, you need to consider the number of image requests, image size, and image definition.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.