[Pro] Cache Prevention

A number of sites I have designed require regular updates & I want to stop them being cached by the browser, each time I make changes. I have tried a number of methods, including the No Cache page action, but nothing seems to work.

Can anybody please advise me how this can be done. Examples of sites I need to implement this for include:

http://www.theoakathockleyheath.co.uk/

http://www.theupgroup.co.uk/

Each of these examples incorporate Flash content that I want to be able to update & replace without having to rename the file name each time I make changes.

Any guidance would be most appreciated.

Thanks.

http://www.davidhutton.com/


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is kind of a trade-off between network performance and visitors
seeing the latest updates, and there’s one more thing to consider
here: frequency of repeat visits.

You may think that people are not seeing the latest, but remember
that’s only true if the site serves a population of visitors who log
in to the site and never leave it. You – the developer – often have
a warped sense of what visitors will see, based on the fact that you
may look at the site more than once an hour, versus other visitors who
might see it once a week or month (if they come back at all).

If you truly want to force a browser to never cache a page, you will
need to have your server send the appropriate HTTP headers along with
the file it serves. I can share a snippet of PHP code which will do
this, but it does require that you change your cache-free pages to PHP
pages (easy to do in Freeway) and it also requires that your host
offers PHP in their regular service (most do).

But choose sparingly the pages you want to do this to. Cacheing was
invented to save on network bandwidth and visitor time, more or less
in equal measure. In this day and age of ultra fast broadband
connections, this may be a non-issue, but let me assure you – for
some people, it is important. If your hosting provider charges you for
going over your monthly bandwidth cap (and most do) then you may get a
shocking bill if your site is popular or your pages are large.

And finally, a word about Flash. If you are trying to force a
ginormous Flash file to always reload, you are going to make your site
appear slow. If you are trying to force an existing “shell” Flash file
to always load the latest version of an XML file or some ancillary
file (rather than the entire Flash thing itself) whenever there’s a
newer version, I think you can get that to happen within Flash, either
by faking a querystring with ‘?latest=’ + new Date().seconds() or
something like that, or with a setting in Flash that causes it to
ignore cached data (again, not sure precisely how you do that – Flash
is rather aggressively not my bag). But the key thing is if you’re
going to force a page to always download and bypass the cache – make
sure it’s a SMALL page.

Walter

On Apr 17, 2009, at 10:48 AM, graphic_inc wrote:

Each of these examples incorporate Flash content that I want to be
able to update & replace without having to rename the file name each
time I make changes.

Any guidance would be most appreciated.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the feedback Walter.

I understand the points you make regarding the cacheing of large files, however sites I design often have several small animated Flash elements on the home page, that promote different areas of a site. These touts are tiny in terms of file size, in fact they are often smaller than if I just had a static image such as a photo. What I wanted to be able to achieve, is to make changes to these touts, resave them & update them in the Resources folder on the server hosting a particular website - rather than having to give them a different file name & republish the page each time.

As you say, it is unlikely that a site is visited as often as a client perceives it is, however when working on sites that are updated regularly the client themselves repeatedly checks a page to view any changes & often panic when they don’t see revisions without emptying the browser cache, as they assume potential visitors won’t see the updates that have been made either.

As the ‘no cache’ action doesn’t work I guess I will have to accept that I will have to rename all updated & republish the page every time changes are made, OR consider your suggestion involving the use of php.

Thanks again,

David
http://www.davidhutton.com


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter,

So how does a page like the Apple home page work. Don’t see a .php in the url and it seems to be updated almost daily?

Our need is very similar to David at Graphic inc. although it is for our own site where there is not a huge amount of traffic but we do want to be sure those who are going to visit again and again see the latest news articles, home page info and such.

We were planing on using the “Cache Buster” Action, does all that has been discussed here mean that this does not do what we were thinking, keep pages from being cached?

Thank You, Team SDA


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Every server is different, and the cache may be manipulated without
you knowing it or seeing any particular server technology “exposed” to
you directly. Looking at a public Web site will reveal only what the
developer has deemed you “need to know”, unless you are a programmer
and have access to tools which can help you read and interpret the raw
headers being sent by the server.

Some hosting providers (and some servers) may be configured to hang on
desperately to the cache. Where are you hosting, and on what sort of
server?

Some ISPs aggressively cache all Web requests – for weeks at a time
– and make it ridiculously hard to break out of that cached content
(which is one possible explanation why you are able to see new stuff
if you rename the various resources). Who is your ISP? (This problem
may be unique to you at home or your office.)

One thing you could try when you are testing your site is to add a
made-up querystring to the end of the URL in your browser, and see if
that “shakes” the browser from its slumbers. So instead of

http://mysite.com

you would enter

http://mysite.com/?t=zdfrfghj

or something equally useless. Servers don’t HAVE to send unique data
when they receive a GET request (which is what this is called when
there is data following a question mark in the URL) but they often
will. Another thing is to use Browsercam or another remote screenshot
service to take a look for you from somewhere else in the world. That
might show you that the problem is unique to you.

If you have a shell account on a Unix server somewhere, you can see
what that server “sees” with nothing more than telnet:

telnet mysite.com 80

with any luck, the server will reply:

Trying 12.34.567.8...
Connected to mysite.com
Escape character is '^]'

type:

GET /

and you should see the entire source code for the home page, followed
by the sign-off:

Connection closed by foreign host.

If you’ve changed something in the HTML, but have not seen that in
your browser, you might see that it’s changed in the source when you
use this “poor man’s Lynx” to look at it. And if it is changed, then
you know the problem is somewhere between your computer and the
server, not your server and the rest of the world.

Walter

On Apr 20, 2009, at 4:51 PM, TeamSDA wrote:

Hi Walter,

So how does a page like the Apple home page work. Don’t see a .php
in the url and it seems to be updated almost daily?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options