Prevent caching of a page

Discussion in 'HTML' started by MG, Mar 22, 2007.

  1. MG

    MG Guest

    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
     
    MG, Mar 22, 2007
    #1
    1. Advertising

  2. 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/
     
    Jukka K. Korpela, Mar 22, 2007
    #2
    1. Advertising

  3. MG

    MG Guest

    "Jukka K. Korpela" <> wrote in message
    news:%7tMh.22124$...
    > 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
    >
     
    MG, Mar 22, 2007
    #3
  4. MG

    Brian Cryer Guest

    "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
     
    Brian Cryer, Mar 22, 2007
    #4
  5. 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!
     
    Jukka K. Korpela, Mar 22, 2007
    #5
  6. MG

    Brian Cryer Guest

    "Brian Cryer" <brian.cryer@127.0.0.1.ntlworld.com> 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
     
    Brian Cryer, Mar 22, 2007
    #6
  7. MG

    MG Guest

    Thanks Brian and Jukka

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

    MG
     
    MG, Mar 23, 2007
    #7
  8. MG

    Michael Guest

    "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.
     
    Michael, Mar 23, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. R. Ian Lee

    Prevent Browser Caching for a Page

    R. Ian Lee, Oct 22, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    8,333
    Jacob Yang [MSFT]
    Oct 23, 2003
  2. Troy Simpson

    Fragment Caching inside page caching?

    Troy Simpson, Jan 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    806
    Troy Simpson
    Jan 19, 2004
  3. Cesare Caldieron

    prevent page caching

    Cesare Caldieron, Aug 23, 2004, in forum: Java
    Replies:
    0
    Views:
    443
    Cesare Caldieron
    Aug 23, 2004
  4. Mike S
    Replies:
    1
    Views:
    615
    Mike S
    Aug 24, 2010
  5. Santhi

    to prevent client side web page caching

    Santhi, Oct 3, 2003, in forum: ASP General
    Replies:
    3
    Views:
    147
    Bullschmidt
    Oct 3, 2003
Loading...

Share This Page