VML cache issue

Recently I wrote another png transparency patch for ie6 which use VML instead of AlphaImageLoader.

AlphaImageLoader have many issues, the most famous one is clickable issue. I also found that it can't be used combined with style.zoom property. And, using AlphaImageLoader filter force to hasLayout which maybe not desired. Finally, It's hard to implement background-repeat and background-position feature.

So VML have no such limitation maybe a better solution. But VML also have own issues --- poor MS!

All VML Shape should be set width and height by hand, so to implement no-repeat, repeat-x or repeat-y, I had to dig the width and height of the image. I can't find anyway to fetch such info from VML. So I create dhtml Image object to preload the image, and get its width and height. It seems ok, but one day when I tune the performance of page loading, I found the image has been loaded twice!

After some testing, I found that VML will not use the cache options built in IE at all. In every session (open a new page), it will read the image even the image has been in cache and not expired. In most case, it will result in http status 304. Though 304 is very small in size, but there are still connections which cost lot, for a pages contains many images, and with a slow network, it will degrade the user experience.

On the other hand, AlphaImageLoader ignores cache options too, it always use cache even you press ctrl+F5. The only way to update the image is clearing cache first.

God bless M$! html, filter, vml -- three components, three behaviors.

About cache, AlphaImageLoader is more acceptable than VML. Because the web developers still have some way to refresh the image (by rename the image) for AlphaImageLoader. On the contrary, there is no way to force VML to respect cache except hack the user's browser (no no i have no interest in writing a browser with ie Trident engine, i'd rather to use Gecko).

So, what should I do?

 

Note: all test under IE 6.0 on Windows XP SP2.

發佈了125 篇原創文章 · 獲贊 0 · 訪問量 36萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章