George asks:
Hi Ray, I have a question. I am doing a site which is using CSS at the moment. I am interested in stopping IE7 from doing a roundtrip to the server every time to see if my images have changed. This causes a flash everytime you click from link to link even though the background image has not changed. Do, you think this PHP solution could be modified for ColdFusion and IIS: http://www.explainth.at/en/tricks/flickfix.shtml
Boy, am I the only happy to not be using Internet Explorer anymore?
If you follow the link in the question above, it details a simple modification that can be made to Apache using .htaccess. George is on IIS and wants to know if he can mimic the solution provided in PHP. First off, do know you can set expiration headers in IIS as well. I've done that for this blog and for RIAForge as well. (And it did seem to make things quite a bit zippier!)
That being said, if you wanted to do it via ColdFusion, it is as simple a matter as using the cfheader tag. Here is a trivial example with a hard coded expiration in 2019:
<cfheader name="Expires" value="Fri, 11 Jan 2019 20:19:44 GMT">
<cfset lynn = imageRead(expandPath("./presentations/cfspry/lynn.jpg"))>
<cfcontent type="image/jpg" variable="#imageGetBlob(lynn)#">
I don't have IE here to check, but I did confirm that Firebug saw the header when the image was requested.
Archived Comments
I don't use IE ... However in developing site for folks I have to check for "browser compatibility" with Internet Destroyer ... I mean Explorer ...
In IE (Icky ...) Go to:
Tools > Internet Options > Browsing History ...
Under Browsing History Change "Check for newer versions of stored pages " to something other than "Every time I visit the web page" or "Automatically" ...
Having the setting "Every time I visit the web page" is great when you are developing a site ... but not for browsing purposes ...
HTH
Reviewing the
PHP, Internet Explorer (the flickering wonder) and FARTS are ALL FREE!
I was looking to see if there's a way to do this using ISAPI_Rewrite, and discovered a new product from Helicon, Ape: http://www.helicontech.com/...
It's currently in beta, and I've not yet tried it myself, but it aims to emulate all the common Apache mod_ extensions, including the mod_expires which is referenced in the article Ray mentions.
So you could set up the expiry header on all images without having to serve them through the CF server...
I assume the problem is in mouseovers, which is about the only time i've noticed background image problems, so I combine my hover images into one and then use CSS positioning to select which image to use. There are lots of resources out there for doing this... Its very simple and is faster since there are less round trips to the server.
Hope this helps.
Ray, for those wanting to do so in IIS, can you post what you set in IIS for this? I know I just had my network guy do it, so I don't have the syntax offhand but it really helped and improved our Yslow score in that area.
This help?
http://www.dotnetjunkies.co...
Helicon Ape is released now and you can use mod_expires module to solve your problem. Also please note 2 new modules (mod_cache and mod_gzip) are added into release.
Please refer to http://www.helicontech.com/ape
to get more info.