zoukankan      html  css  js  c++  java
  • filter:expression(document.execCommand("BackgroundImageCache",false,true) 转

    IE6下的背景图片每次使用都会重新发送请求(not 本地),连一个hover效果时候同样的背景图片仅仅位置不同而已,ie6都会再次发送请求,这个令人崩溃的事情需要解决掉:

    对于ie来说,filter:expression 很强大,能够实现的功能超级多,但是更对于视效率如生命的程序员来说,它的效率不敢令人恭维,所以有人会用css方法实现ie6下背景图片缓存,但是这种人也就是崇拜微软的强大而已,无它

    有人会用css方法实现ie6下背景图片缓存:

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

    当然大多数人都会选择js方法实现:

    (function(){
    try{
    var userAgent = navigator.userAgent.toLowerCase();
    var env = null;
    var ver = 0;
    env = userAgent.match(/msie ([d.]+)/);ver = env ? parseInt(env[1], 10) : 0;
    if(ver == 6){
    try{
    document.execCommand("BackgroundImageCache", false, true);
    }catch(e){}
    }
    }catch(e){}
    })();
  • 相关阅读:
    【PBR的基本配置】
    【super vlan的配置】
    Day_03-函数和模块的使用
    Day_02-Python的循环结构
    Day_02-Python的分支结构和循环结构
    Day01_课后练习题
    Day01_初识Python
    一、Linux知识体系结构图
    NAND Flash结构及驱动函数
    区分大端和小端
  • 原文地址:https://www.cnblogs.com/bigdesign/p/3989737.html
Copyright © 2011-2022 走看看