How to Stop IE6 Caching Downloads
Update: The method described below will cause IE7 to drop the extension. A modified version is pending.
Until recently, I had no idea that IE6 cached downloads. I knew page and image caching were issues, but I didn’t know if affected exe’s and zip’s as well.
FlowBreeze 2.0 was released 11 days ago, putting some of the 30-day trial users in the bubble. They were using the 1.4 version, so they’d come to the site, download the new version, and install … Version 1.4?!?
One customer didn’t think I’d believe him, so he took screenshots of each step: clicking the download button, saving to the Desktop, and running the setup file, which clearly said version 1.4 on the screen.
Thanks to the folks on the BoS forums, I figured out the problem and wrote a little Javascript to resolve it. If you are running dynamic pages, server side scripting would be more robust. But if you’re all HTML like I am here at BreezeTree then this should work in a pinch:
function UpdateDownloadLinks() {
var i;
var linkLength;
var linkType;
var linkCount = document.links.length
var randNum = Math.round((Math.random()*10000));
for (i = 0; i < linkCount; i++) {
linkLength = String(document.links[i].toString()).length;
linkType = String(document.links[i].toString().toLowerCase()).substring(linkLength, linkLength - 3);
if ((linkType == "exe") || (linkType == "zip"))
document.links[i].href += "?fid=" + randNum;
}
}
(N.B.: I haven’t played with Javascript in years, so if this code sucks, leave a comment below and let me how to make it unsuck.)
The script downloaded by clicking here.
20. October 2007 at 1:28 pm :
I guess he could’ve cleared out his IE cache if he realized that was what it was doing. Good thing to know about the caching though.
20. October 2007 at 5:28 pm :
About 45% of my visitors are still using IE6, so, of course, asking them all to go to Tools - Options - etc. and clear out their caches wouldn\’t be user friendly or realistic. So The dummy param seems to be the best trick.
Their are some things you can do on Apaches systems to get around this. But I\’m on IIS, so that\’s just one more reason I may switch to a Linux host down the road.