Solutions to CSS image caching problems in IE6

Source: Internet
Author: User

You can use the following code: Copy codeThe Code is as follows: document.exe cCommand ("BackgroundImageCache", false, true );

Of course, for other browsers to pass normally, you need to make a judgment before calling, to make it safer:

Copy codeThe Code is as follows: if (Browser. isIE6 ){
Try {
Document.exe cCommand ("BackgroundImageCache", false, true );
}
Catch (e1 ){}
}

The Platform Detection code can be written like this, from Ext source code:

Copy codeCode: var Browser = {};
Try {
(Function (){
Var idSeed = 0,
Ua = navigator. userAgent. toLowerCase (),
Check = function (r ){
Return r. test (ua );
},
DOC = document,
IsStrict = DOC. compatMode = "CSS1Compat ",
IsOpera = check (/opera /),
IsChrome = check (/\ bchrome \ B /),
IsWebKit = check (/webkit /),
IsSafari =! IsChrome & check (/safari /),
IsSafari2 = isSafari & check (/applewebkit \/4/), // unique to Safari 2
IsSafari3 = isSafari & check (/version \/3 /),
IsSafari4 = isSafari & check (/version \/4 /),
IsIE =! IsOpera & check (/msie /),
IsIE7 = isIE & check (/msie 7 /),
IsIE8 = isIE & check (/msie 8 /),
IsIE6 = isIE &&! IsIE7 &&! IsIE8,
IsGecko =! IsWebKit & check (/gecko /),
IsGecko2 = isGecko & check (/rv: 1 \. 8 /),
IsGecko3 = isGecko & check (/rv: 1 \. 9 /),
IsBorderBox = isIE &&! IsStrict,
IsWindows = check (/windows | win32 /),
IsMac = check (/macintosh | mac OS x /),
IsAir = check (/adobeair /),
IsLinux = check (/linux /),
IsIpad = check (/ipad /),
IsSecure =/^ https/I. test (window. location. protocol );
Extend (Browser ,{
IsOpera: isOpera,
IsIE: isIE,
IsIE6: isIE6,
IsFirefox: isGecko,
IsSafari: isSafari,
IsChrome: isChrome,
IsIpad: isIpad
});
})();
} Catch (e ){}

// The extend method above is also very easy

Copy codeThe Code is as follows: function extend (obj1, obj2 ){
For (var o in obj2 ){
Obj1 [o] = obj2 [o];
}
Return obj1;
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.