Hi, I want to force an swf file on one of my website pages not to load from cache. If it loads from cache it does so incorrectly. Any ideas how to do this? + rep for anybody who helps! -Gaz
you can add a random number to the location of the swf. This way the browser sees it as a different url. Here's a php code that do so: <embed src="myflash.swf?<?php echo md5(microtime()); ?>"></embed> PHP:
Thanks for the response That's a good idea but unfortunately I don't think it will help as I'm already using .swf?variable= *string here* The very problem is that until I refresh the page the variable won't show up in the flash movie. ie. the page loads and the movie plays but the movie doesn't recieve the variable until I hit refresh, loading the whole page again Here is an example of the flash embed I'm using (which is generated using php like in your example). <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" width="550" height="400"> <param name="movie" value="http://www.sitename.com/swf/demo.swf?gazcode=1aa1ba1ca1da1ea1fa1ga1" /> <param name="quality" value="high" /> <embed src="http://www.sitename.com/swf/demo.swf?gazcode=1aa1ba1ca1da1ea1fa1ga1" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed> </object> Code (markup): Any ideas?
Thanks, I'll have a look in to that tonight. Does it prevent the page from caching or prevent the browser from using a cached version of the page? + REP left for both of the responses so far Thinking about it it would actually be preffereable if the swf could be cached since some of them will be 2mb+, I just need the stupid swf to remember to include the variable after the question mark Does anybody have any more ideas?
yup, all you have to do is load it with a random querystring or have a static flash, that just laods another flash and the static "preloader" just builds a random integer and applies it to loading the other one. embed preloader.swf preloader.swf loads "yourmovie.swf?randint=" + randomNumber
@ccoonen So why does <embed src="http://www.sitename.com/swf/demo.swf?gazcode=1aa1ba" ></embed> Code (markup): appear the same as <embed src="http://www.sitename.com/swf/demo.swf" ></embed> Code (markup): until I press refresh?
Well, web-browsers generally will try to cache anything it loads "INCLUDING" flash .swf files. If you hit your demo.swf in a webbrowser, then change it and hit refresh in teh browser, you will see it might be the same (no change applied). Then do a hard refesh and the change will be reflected. By adding a random querystring it tricks the web-browser into thinking it is a totally different file its loading.
first of all adding random number have to help also you may use this headers header('Content-type: application/x-shockwave-flash'); header("Expires: Thu, 01 Jan 1970 00:00:00 GMT, -1 "); header("Cache-Control: no-cache, no-store, must-revalidate"); header("Pragma: no-cache"); Code (markup): also read this http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14743&sliceId=1