欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

让IE对背景图进行缓存 解决ie6下背景闪动问题document.execCommand("BackgroundImageCache",false,true)

程序员文章站 2022-07-14 20:17:49
...

让IE对背景图进行缓存 解决ie6下背景闪动问题document.execCommand("BackgroundImageCache",false,true)

IE的cache设置为Every visit to the page,而不是默认的Automatically。IE6下设置背景图片是不会被真正cache住的.但一般只有开发者才会把cache设置为每次访问检查更新,所以这个bug不会影响到真正的用户。

--------------------------------------------------

 

<body onload="document.execCommand('BackgroundImageCache',false,true)">

上面是网页版QQ http://qun.qq.com/air/ 的代码 

-------------------------------------------------

 

var isIE = ua.indexOf("msie") > -1, isIE7 = ua.indexOf("msie 7") > -1;
// remove css image flicker
if(isIE && !isIE7){
     try{
         document.execCommand("BackgroundImageCache", false, true);
     }catch(e){}
}

上面是EXT的实现