解决IE6 css背景图片缓存问题

 

IE6下默认不缓存背景图片,CSS里每次更改图片的位置时都会重新发起请求,用这个方法告诉IE6缓存背景图片

解决IE下图片作为背景时,会有闪烁:

 

方法一、css(推荐使用)

html {zoom:expression(function(ele){ele.style.zoom = "1";document.execCommand("BackgroundImageCache", false, true);}(this));}

 

方法二、js

try {

  document.execCommand('BackgroundImageCache', false, true);

} catch(e) {}

 

方法三、css expression (不推荐)

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

 

 

 

 

posted @ 2013-12-19 23:19  赵小磊  阅读(447)  评论(0)    收藏  举报
回到头部