`

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

阅读更多

让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的实现

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics