Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: browser cache

  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    browser cache

    Hi!

    I don't know if I ask this in the right place, but:

    Is it possible to prevent ie to save files in temporary internet files folder?
    I mean disable it with javascript or anything else.

    I tried this:

    Code:
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
    header("Pragma: no-cache");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    But when a call a picture with <img.... it still stored in temp folder.

    Thx for your help

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,928
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    In order to assure a non-cache, you should add a meta tag like below after the <head> tag of your webpage:

    META HTTP-EQUIV="Pragma" CONTENT="no-cache"
    META HTTP-EQUIV="Expires" CONTENT="-1"

    If your page is coming from a server side script (PHP or otherwise) you can use this simple technique:

    <img src="myimage.jpg?insert_datetime_stamp_here" alt="Some text" />

    Use whatever function in your server side script that will put the current date and time into that space after the ?. That will prevent cacheing.
    Last edited by Philip M; 05-20-2009 at 04:05 PM.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,302
    Thanks
    10
    Thanked 586 Times in 567 Posts
    Quote Originally Posted by Philip M View Post
    <img src="myimage.jpg?insert_datetime_stamp_here" alt="Some text" />

    Use whatever function in your server side script that will put the current date and time into that space after the ?. That will prevent cacheing.
    doesn't seem to work for me (IE7).
    in fact, it actually makes it worse: it stores a new copy each time it's loaded that way (in my testing).

    you could serve just the images from an HTTPS site.
    since images can come from anywhere, the HTML should work exactly the same.
    browsers shouldn't cache HTTPS-based resources, and when i tested in IE7, that seems to be the case with images.
    Last edited by rnd me; 05-21-2009 at 06:46 AM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #4
    New Coder
    Join Date
    Oct 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Since the pictures I need are stored on a non-https server and timestamp solution has the same results as Rnd me had
    "it stores a new copy each time it's loaded that way" (IE8) it seem it's just not possible to do..

    Thank you anyway


  •  

    Posting Permissions

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