Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Prevent caching of a page

Reply
Thread Tools

Prevent caching of a page

 
 
MG
Guest
Posts: n/a
 
      03-22-2007
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


 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-22-2007
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.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
 
MG
Guest
Posts: n/a
 
      03-22-2007

"Jukka K. Korpela" <> wrote in message
news:%7tMh.22124$ .fi...
> 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.
>
> --
> Jukka K. Korpela ("Yucca")
> http://www.cs.tut.fi/~jkorpela/


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
>



 
Reply With Quote
 
Brian Cryer
Guest
Posts: n/a
 
      03-22-2007

"MG" <> wrote in message
news:...
<snip>

> 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.


From http://www.cryer.co.uk/resources/javascript/html1.htm:

<meta http-equiv="Pragma" content="no-cache">

--
Brian Cryer
www.cryer.co.uk/brian


 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-22-2007
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.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Join the Clueless Club by quoting this sig!

 
Reply With Quote
 
Brian Cryer
Guest
Posts: n/a
 
      03-22-2007
"Brian Cryer" <> wrote in message
news:...
>
> "MG" <> wrote in message
> news:...
> <snip>
>
>> 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.

>
> From http://www.cryer.co.uk/resources/javascript/html1.htm:
>
> <meta http-equiv="Pragma" content="no-cache">


Note that this is almost certainly only used by the browser, and as Jukka
has pointed out there are many other places where the page could be cached.
(His comments and observations are all good by the way.)
--
Brian Cryer
www.cryer.co.uk/brian


 
Reply With Quote
 
MG
Guest
Posts: n/a
 
      03-23-2007
Thanks Brian and Jukka

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

MG


 
Reply With Quote
 
Michael
Guest
Posts: n/a
 
      03-23-2007
"MG" <> schreef in bericht
news:...
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XHTML 1.0 Transitional - prevent page caching, how? Mike S HTML 1 08-24-2010 02:38 AM
prevent page caching Cesare Caldieron Java 0 08-23-2004 04:19 PM
Fragment Caching inside page caching? Troy Simpson ASP .Net 0 01-19-2004 11:57 AM
Prevent Browser Caching for a Page R. Ian Lee ASP .Net 3 10-23-2003 02:47 AM
to prevent client side web page caching Santhi ASP General 3 10-03-2003 10:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57