Background image cache under IE6

Background image cache under IE6

CSS background image flickering bug in IE6 (background image cache problem in IE6)

IE6 will re-send the request for each background image (not local) every time it is used. Even when there is a hover effect, the same background image is only in a different position, and IE6 will re-send the request. This frustrating thing needs to be solved:
For IE, filter:expression is very powerful and can realize a lot of functions. However, for programmers who value efficiency as their life, its efficiency is not satisfactory. Therefore, some people use CSS method to realize background image caching under IE6, but such people just admire the power of Microsoft:

Copy code
The code is as follows:

html {filter:expression(document.execCommand("BackgroundImageCache", false, true));} Of course, the disadvantage is that it may slow down the loading speed of the entire page.

Most people will choose the js method to implement:

Copy code
The code is as follows:

<script type='text/javascript'>
document.execCommand("BackgroundImageCache", false, true);
</script>

Disadvantages: Errors will occur if executed in browsers such as Firefox.

So you need to determine whether it is an IE browser, using the judgment method provided by jQuery as follows:

Copy code
The code is as follows:

<script type='text/javascript'>
if ($.browser.msie) {
document.execCommand("BackgroundImageCache", false, true);
}
</script>

An even simpler approach is to use IE's conditional comments:

Copy code
The code is as follows:

<!--[if lt IE 7]>
<script>document.execCommand("BackgroundImageCache",false,true);</script>
<![endif]-->

<<:  Use CSS blend modes and SVG to dynamically change the color of your product images

>>:  How to use IDEA to create a web project and publish it to tomcat

Recommend

How to use ES6 class inheritance to achieve a gorgeous ball effect

Table of contents introduce Implementation steps ...

Summary of bootstrap learning experience-css style design sharing

Due to the needs of the project, I plan to study ...

HTML web page creation tutorial Use iframe tags carefully

Using iframes can easily call pages from other we...

Explanation and example usage of 4 custom instructions in Vue

Four practical vue custom instructions 1. v-drag ...

5 ways to determine whether an object is an empty object in JS

1. Convert the json object into a json string, an...

MySQL database deletes duplicate data and only retains one method instance

1. Problem introduction Assume a scenario where a...

Nginx monitoring issues under Linux

nginx installation Ensure that the virtual machin...

Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial

Uninstall MariaDB CentOS7 installs MariaDB instea...

Docker deploys Mysql, .Net6, Sqlserver and other containers

Table of contents Install Docker on CentOS 8 1. U...

Mac node deletion and reinstallation case study

Mac node delete and reinstall delete node -v sudo...