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;
}