Loading...
 
[Show/Hide Right Column]

Development

Browser caching ...

... is evil. For example, let's say my SWF requests an XML file from the server in order to get video information, which it then receives and operates on. Well, there's no guarantee that file is the latest file, as browsers seem to not even bother checking if a new one needs to be downloaded and just use the cache instead. Let's then go ahead and say that someone (me) is going to be editing that XML file A LOT because that's where all the important video and interactive object information is stored. The SWF isn't going to see any of those changes because the browser is too stupid do grab the right file.

Unbelievably, the fix is this:


	var url:String = "myXMLFile.xml" + "?" + new Date().getTime()

	var loader:URLLoader = new URLLoader();
	var request:URLRequest = new URLRequest(url);
	loader.load(request);




Does anyone else find this incredibly idiotic? So to get an XML file named "myXMLFile.xml" you need to request "myXMLFile.xml?1225568783273" or whatever. And does that mean the browser is caching like 500 different versions of myXMLFile, one for each call?

Other, more ridiculous solutions have included generating a random number and appending that to the url. Why should we have to do this?

(plus my mouse is malfunctioning and double-clicking when I single-click. Hateful in the extreme!)