Ieimage save document.exe cCommand ("BackgroundImageCache", false, true)

Source: Internet
Author: User

The Pixy method will flash when it is affected by the cache bug of IE. In fact, this problem is not clearly stated, but the bug is actually conditional, that is, the IE cache is set to Every visit to the page, rather than the default Automatically. Basically, only developers can set the cache to check for updates each time, so this bug does not affect real users (according to the test in ie6 of winxpsp2, although a network access api may still be called, there is no actual request. The symptom is that the mouse is shaking for a very short period of time, but the image will not flash ). In addition, someone found an undisclosed Method for IE to cache the background image: document.exe cCommand ("BackgroundImageCache", false, true)
This method even avoids api calls, and seems to be directly cached in IE memory.

In IE6, background images are not actually cached. Even if the server has a cache, you can only ~~~

People who have done uidesign and Development know that IE (excluding IE7) will often reload background images from the server, and the UI of the good end will be on IE (excluding IE7) ......

Erik found a simple solution (effective for IE of IE7 or earlier, but this Bug has been fixed in IE7)

Program codeCopy codeThe Code is as follows: document.exe cCommand ("BackgroundImageCache", false, true );

When reading the Ext source code today, Jack Slocum has taken this into account. js provides its implementation. This kind of code should not be available in other Ajax frameworks. From this details, we can see that Ext is comprehensive ~

Program codeCopy codeThe Code is as follows: var isIE = ua. indexOf ("msie")>-1, isIE7 = ua. indexOf ("msie 7")>-1;
// Remove css image flicker
If (isIE &&! IsIE7 ){
Try {
Document.exe cCommand ("BackgroundImageCache", false, true );
} Catch (e ){}
}

This day, when I read the source code of the dreamplayer player, I found that magic has fixed the background cache for IE, but he did not consider that IE7 does not exist. This is evml. A piece of related code in js ~ (By the way, this guy never gives extra points for writing JavaScript code. It used to be like this. Now it's still like this. How can we compress it? Khan ~ The following code adds a semicolon according to my habits, even if there are only two or three sentences ~)

Program codeCopy codeThe Code is as follows: window. isIE = navigator. appName. indexOf ("Microsoft") = 0;
If (isIE ){
Document.doc umentElement. addBehavior ("# default # userdata ");
Document.exe cCommand ("BackgroundImageCache", false, true );
}

A while back a lot of people where covering how to work around the bug that IE always
Reloads background images from the server, leading to your UI flickering.
Dean wrote one and lots of others wrote the same thing. Today, I saw this simple workaround
(From a fellow Googler who worked at Microsoft before ):

Document.exe cCommand ("BackgroundImageCache", false, true)

Much simpler but makes me wonder why this is not the default setting?

/**
* Reply
* By Nicolas C. Zakas @ 2007-02-26
*/
I 've actually wondered about this "bug" for a while.
I'm sure somewhere along the line this demo-was made for a logical reason...
Maybe they didn't anticipate how much background images wocould be used, or maybe they thought
There was some use case under which it wocould be desirable not to cache the background image.
I'm generally not big on overriding things that seem to be design decisions (which this seems to be ).
I 've never really thought this was a "bug "... Bugs don't usually have switches that say "turn off bug ".

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.