[development] preventing browser cache
metzler.dl at gmail.com
Fri Dec 10 00:57:23 UTC 2010
WE use this technique to stop IE from stubbornly caching swf files, etc. But if you don't have control of the URL that the java applet references, then you won't likely have much luck. The reason that this works is because it makes the urls different, so it doesn't see the cached version as the same fie.
Rather than a random character, try including the file modification time so that it caches when it should and doesn't when it shouldn't. Something like:
the number wold be the unix time stamp of the file modification time or the current timestamp if you want it to load every page.
On Dec 9, 2010, at 2:17 PM, Blake Senftner wrote:
> Thanks for the tip Mike. These are files on disk.
> bsenftner at earthlink.net
> On Dec 9, 2010, at 1:09 PM, Michael Prasuhn wrote:
>> 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.
>> Michael Prasuhn
>> 503.512.0822 office
>> mike at 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.
>>> 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?
>>> bsenftner at earthlink.net
More information about the development