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

Nodejs plug-in and usage summary

The operating environment of this tutorial: Windo...

WeChat applet uniapp realizes the left swipe to delete effect (complete code)

WeChat applet uniapp realizes the left swipe to d...

JS implements Baidu search box

This article example shares the specific code of ...

Binary Search Tree Algorithm Tutorial for JavaScript Beginners

Table of contents What is a Binary Search Tree (B...

HTML page jump and parameter transfer issues

HTML page jump: window.open(url, "", &q...

How to configure Hexo and GitHub to bind a custom domain name under Windows 10

Hexo binds a custom domain name to GitHub under W...

Analysis of the implementation principle of Vue instructions

Table of contents 1. Basic Use 2. Working Princip...

MySQL SQL statement analysis and query optimization detailed explanation

How to obtain SQL statements with performance iss...

The latest graphic tutorial of mysql 8.0.16 winx64 installation under win10

In order to download this database, it takes a lo...

Vue realizes price calendar effect

This article example shares the specific code of ...

Detailed tutorial on installing the jenkins container in a docker environment

Recommended Docker learning materials: https://ww...