Forum Moderators: open

Message Too Old, No Replies

how to check if document has changed(different than in cache)?

         

merijnvw

11:47 pm on Feb 21, 2010 (gmt 0)

10+ Year Member



Hi, I have an embedded object element that once in a while reloads for reasons I won't explain. It all works, the only thing I find annoying is the flash everytime when it reloads. 95% of the reloads is useless(when the document hasn't changed) but it reloads so frequently because when it changes, it has to be shown quickly.
I'm not sure in which language to do this, but can I do a check wether the document has changed since last visit or not? When that's possible, I can reduce the amount of reloads.
Or can I just get rid of the loading flash in another way?
thanks

daveVk

3:37 am on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



apache expiresbytype command may be relevent.

rocknbil

6:13 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Caching of almost any kind is a fault of the browser not recognizing that the page or object indeed has changed.

An old trick we used to use (and still can) to prevent images from pulling a cached copy of a same named file is to generate some unique identifier - something like time + users IP - and append it to the src as a query string:

image.jpg?3458734256833685432

This is not a "great" idea for SEO, but if SEO is irrelevant to the current "object" - doesn't matter what it is - this is one way you can do this.

object.swf?45656867676788568678

You may have to do something so the Flash itself doesn't "get confused" by the query string, but this could work. Generate it server-side or with JS, doesn't really matter.

merijnvw

8:49 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



DaveVk, thanks for your reply, I'll look for that.
Rocknbil, thanks too, but I think you understood me incorrectly. Btw I also use that time adding trick :)

vol7ron

7:21 pm on Mar 5, 2010 (gmt 0)

10+ Year Member



Rocknbil, I think your method would cause it NOT to be cached, while merijnvw looks like he WANTS it cached.

merijnvw,
In line with what daveVk said, if you're using Apache, make sure you set the Expires Headers on the objects at hand.