IE6 background Picture not caching problem solution and picture use strategy multiple methods summary _javascript skill

Source: Internet
Author: User
Workaround one: IE6 hack script
Copy Code code 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 ("IE 6.0");
try {
Document.execcommand ("Backgroundimagecache", false, fix);
}catch (err) {}
}
}
</script>

Workaround two: IE6 hack annotation
Copy Code code as follows:

<!--[if IE 6]>
<script type= "Text/javascript" ><!--
Document.execcommand ("Backgroundimagecache", false, true);
--></script>
<! [endif]-->

Solution three: IE6 hack style
Copy Code code as follows:

HTML {}
{
Filter:expression (Document.execcommand ("Backgroundimagecache", False, true));
}

However, the above methods can not solve the problem of using innerHTML in the image, Microsoft Official explanation reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;319546

Solves the problem that the background picture caches, the use of the Web picture can be defined with the background-image of the CSS, and use the cache only to visit once. For the IMG tag, some sites adopt a 1 pixel gif image as the SRC value, which means that the content is defined by the style class as:
Copy Code code as follows:

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


The problem with using pictures in Web applications is the number of times a picture is requested, the size of the picture, and the clarity of the picture.

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.