Monday, May 18, 2009

Caching Tutorial

While checking my rss, I found quite interesting resource - all about web cache, how to use it, how to avoid caching. Caching tutorial.
In my work to avoid caching swf files or external resources, such as xml files or images, I am using following practice - to append random value to the url.

url="{ 'externalResource.xml?' + new Date.milliseconds }"

Nothing new, it is common practice and it is works perfectly.

I use SWFObject to embed swf file in html page and same solution to prevent swf from caching:

var randomNumber=Math.floor(Math.random()*10000);
swfobject.embedSWF("index.swf?"+randomNumber, "alternativeContent", "100%", "100%", "9.0.115", "expressInstall.swf", flashvars, params, attributes);

And there is Adobe's TechNote How to prevent caching of swf files.

No comments:

Post a Comment