[development] preventing browser cache

Michael Prasuhn mike at mikeyp.net
Thu Dec 9 21:09:56 UTC 2010


That is only needed with actual files on disk, if your XML is returned from a Drupal menu callback, it's cache-expire headers should be set far in the past to prevent caching. Check this out with curl -v to see what's going on.

-Mike
__________________
Michael Prasuhn
503.512.0822 office
mike at mikeyp.net
http://mikeyp.net

On Dec 9, 2010, at 1:05 PM, Blake Senftner wrote:

> 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