Results 1 to 2 of 2

Thread: Image caching - Cache-control: no-store, no-cache ...

  1. #1
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Image caching - Cache-control: no-store, no-cache ...

    Hi,

    I have created a simple page where I want to show automatically refreshed picture.
    This picture still have a same name - sshot.jpg, but its content changes (it is output of other program which runs on a server).

    So I setTimeout and in refresh function I have:
    window.document.getElementById('sshot').src="sshot.jpg"

    Problem is, that browser still show first loaded picture, even this picture changes over time.

    I've googled that to prevent cacheing, there must be something like this in html:
    <meta http-equiv="Cache-Control" content="no-store,no-cache, must-revalidate,post-check=0, pre-check=0,max-age=0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    -it does not help, browser(ff) still uses first cached picture.

    I found out, that if I disable memory cacheing using about:config by setting
    browser.cache.memory.enable to 'false' then it works well. But it is not a way how to do it, I can not ask user to change setting of their browser. So I tried to add onload function where I do this:
    user_pref("browser.cache.memory.enable",false);
    -it also does not help...

    So my question is - how can I prevent ff to cache image, how can i ask it "load image from disk, do not use cache" ?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    function updateImage(){
    var d=new Date().getTime();
    document.getElementById('sshot').src='sshot.jpg?d='+d;
    }
    setInterval('updateImage()', 3000);
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •