Pixy方法受到IE的cache bug影響會閃爍。其實并沒有說清楚這個問題,但其實該bug是有條件的,即IE的cache設置為Every visit to the page,而不是默認的Automatically。基本上,只有開發者才會把cache設置為每次訪問檢查更新,所以這個bug其實不會影響真正的用戶 (根據在winxpsp2的ie6下測試,雖然可能仍然調用了一次網絡存取的api,但是并沒有發生實際的請求,癥狀就是鼠標有極短時間的抖動,但是圖像 不會閃爍)。此外有人發現了一個未公開的方法來讓IE對背景圖進行緩存: document.execCommand("BackgroundImageCache",false,true) 用這種方法甚至避免了api調用,貌似是直接緩存在IE內存中。
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):
Much simpler but makes me wonder why this is not the default setting?
/** * 相關回復 * by Nicholas C. Zakas @2007-02-26 */ I've actually wondered about this "bug" for a while. I'm sure somewhere along the line this decision was made for a logical reason… maybe they didn't anticipate how much background images would be used, or maybe they thought there was some use case under which it would 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".