Prevent caching of a page

M

MG

URL:
http://www.samurdermysteries.co.za/gal.htm

Someone will visit this page to see if their photos are there. They aren't.

The photos now get uploaded. When the visitor returns to the page, the page
loads from cache so the visitor still can't see the photos.

Pressing the refresh button on the browser sometimes works, sometimes it
doesn't. Same for F5. I have heard that Ctrl-F5 works better, but I'm not
sure what this is or how well it works with different browsers.

The best solution would be to prevent caching in the first place. I believe
there is a meta tag that can do this, but my HTML reference doesn't mention
it.

Can anyone help me on this.

Thanks
MG
 
J

Jukka K. Korpela

Scripsit MG:
Someone will visit this page to see if their photos are there. They
aren't.

So? You don't describe the upload process, but if it is rational, it does
not use "placeholder" images for nonexistent images. Apparently the problem
is that it does. Fix that.
Pressing the refresh button on the browser sometimes works, sometimes
it doesn't. Same for F5. I have heard that Ctrl-F5 works better,
Yes.

The best solution would be to prevent caching in the first place.

Not at all. Caches are your friend.
I believe there is a meta tag that can do this,

You're wrong. A meta tag applies to the HTML document where it resides, so
it cannot affect any images.

Although it _is_ possible to affect caching images, I'm not giving any
references, since that would be the wrong path. Fix what's broken.
 
M

MG

Jukka K. Korpela said:
Scripsit MG:


So? You don't describe the upload process, but if it is rational, it does
not use "placeholder" images for nonexistent images. Apparently the
problem is that it does. Fix that.


Not at all. Caches are your friend.


You're wrong. A meta tag applies to the HTML document where it resides, so
it cannot affect any images.

Although it _is_ possible to affect caching images, I'm not giving any
references, since that would be the wrong path. Fix what's broken.

Sorry, I didn't explain the upload process.

What I do is create a complete new HTML page containing the pictures. No
problems here.

The page in question (http://www.samurdermysteries.co.za/gal.htm) doesn't
contain any pictures at all. It is a page of links. On this page I put new
link to the newly created page containing the pictures. It is this page of
links that has the problem. The newly created link is not visible to
visitors who recently visited the page.

MG
 
J

Jukka K. Korpela

Scripsit MG:
The page in question (http://www.samurdermysteries.co.za/gal.htm)
doesn't contain any pictures at all. It is a page of links. On this
page I put new link to the newly created page containing the
pictures. It is this page of links that has the problem. The newly
created link is not visible to visitors who recently visited the page.

OK, so it is not about images at all. Whether the newly added link refers to
a page with images is immaterial, as is its being a link. So this is about
caching the HTML document. Then the classical advice is that you should read
the classical treatise on practical caching:
http://www.mnot.net/cache_docs/

To take a shortcut, you could first check the current cacheability, using
e.g.
http://www.ircache.net/cgi-bin/cacheability.py
This shows, in this case, that there is no explicit cacheability
information, and caches will probably make freshness guesses based on the
last modification of the page. For most purposes, this is just fine.

Authors often get wild about caches when they edit a page and have
difficulties in seeing the modified version. They don't realize that
visitors don't experience such problems. When I visit your page, I normally
get it from your server, though at times I might get it from my ISP proxy
cache if some other user visited it very recently, e.g. 10 minutes ago, and
in that case I would get it somewhat faster - and I might get it even when
your server is temporarily unreachable. The odds of getting an old version
that way are very small. But to the _author_, the situation is different.

Do you still want to defeat caching?

Note that nothing that you put into the HTML document can affect the way an
ISP's caching proxy works, for example, since the proxy doesn't even look at
the _content_, only HTTP headers.
 
M

MG

Thanks Brian and Jukka

I think I will go for the meta tag, but not mess with http headers.

MG
 
M

Michael

MG said:
Thanks Brian and Jukka

I think I will go for the meta tag, but not mess with http headers.

MG

Actually, I think messing with the headers is better :)
When setting character encodings, redirects and HTTP status codes, for
example, using the HTTP headers will tell the browser the correct
information _before_ it starts rendering. If you use meta tags, it will
probably start rendering with the defaults (provided by your HTTP server)
instead, and only switch when it encounters the META tag, which could cause
for some unexpected behaviour (believe me, I found out :)).

But of course, if you want to do pure HTML without using server-side
scripting, you have little choice I suppose.

Regards

Michael.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top