[development] preventing browser cache

Blake Senftner bsenftner at earthlink.net
Thu Dec 9 21:05:06 UTC 2010


I'm finding that I need to implement a browser cache prevention scheme for dynamic content I am generating.

My use case: user supplied info gets converted into XML and loaded by a java applet on the same page.

I'm seeing the java applet load cached versions of the data, and I want to prevent this. 

I don't have the ability to modify the java applet, and it always loads it's XML from the same filename. 

I'm thinking about using the same technique that I see Drupal use for javascript files, where the src attribute's file url has a fake query string at the end, something like "/misc/drupal.js?5" , where the "?5" is the fake query string.

It's my understanding that this prevents browser caching, and ultimately does not trigger a query - so it's a great method for cache prevention of dynamic content. 

Is my understanding correct? I've not done this before. Is it simply a matter of placing a single random character after the question mark? 
To anyone that has implemented a scheme such as this: any pitfalls I should be aware? 

Sincerely,
-Blake
bsenftner at earthlink.net
www.BlakeSenftner.com
www.MissingUbercartManual.com



More information about the development mailing list