How to prevent caching of swf files
Web browser caching
SWFs, likeother documents and media retrieved by a Web browser, are often saved,or cached, locally on the user's hard drive. The next time that mediais requested the Web browser may load the file from the cache insteadof downloading it over the network. This might be desirable for a Flashmovie whose content doesn't change often but undesirable for SWFs thatare updated frequently with new content or information.
Using the following techniques, SWFs can be forced to expireimmediately from the Web browser's cache or the browser can be forcedto re-download the media upon every attempt to access it.
Note: The META tags used below will only work with browsers that support these tags.
Use one of three methods to ensure SWF files are downloaded each time:
- Using the 'Expires' header.The Expires header of an HTML document tells a Web browser when acached document should expire from the cache. Using a date in the pastensures the document will always be expired.
Insert the text below between the <HEAD></HEAD> tags of the HTML document containing the embedded SWF.<!-- BEGIN INSERT --><META HTTP-EQUIV="Expires" CONTENT="Mon, 04 Dec 1999 21:29:02 GMT"><!-- END INSERT -->
Each and every time this document is requested the browser will noticethat the cached version has expired and will download the file fromit's server of origin. - Using the Pragma: No-Cache header. This code directs the browser to not cache the document at all.
Insert the following text after the closing </BODY> tag of the HTML page containing the embedded SWF.<!-- BEGIN INSERT --><HEAD><META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"></HEAD><!-- END INSERT -->
Note:the Pragma: No-Cache header does not work with Internet Explorer 5.Microsoft recommends using the Cache-Control header, instead. SeeMicrosoft's article on this subject. - When linking between HTML pages, it's possible toforce the linked page to be loaded from it's server of origin and notfrom the browser cache. To do this simply place a query-stringoperator, ?, followed by a number on the end of the link URL.
For example, if one HTML page contains a link to another page called'stockPrices.htm', then to force the browser to download the latestversion of that page from the Web server set up the link in the HTMLpage like this:<A HREF="stockPrices.htm?1">Current stock prices</A>