clear the cache using javascript/HTML/cgi/
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: clear the cache using javascript/HTML/cgi/

  1. #1
    Join Date
    Sep 2005
    Posts
    10

    clear the cache using javascript/HTML/cgi/

    I am facing a technical issue. How to disable browser/server cache through code(HTML, javascript, cgi-perl). I have tried following tags under<head> </head> tag, but this is not working
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="EXPIRES"
    CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

    But this is not working. I have also tried following code but of no use.
    <HTML>
    <HEAD>
    <TITLE>---</TITLE>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    </HEAD>
    <BODY>

    Text in the Browser Window

    </BODY>
    <HEAD>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    </HEAD>
    </HTML>
    If I view source of page, I see these tags but content is not updated.



    plz help me out

  2. #2
    Join Date
    Sep 2005
    Posts
    23

    Re: clear the cache using javascript/HTML/cgi/

    Hi,

    Maybe this is useful for you:
    http://www.mnot.net/cache_docs/

    Best regards,
    Henning

  3. #3
    Join Date
    Jun 2005
    Posts
    1,255

    Smile Re: clear the cache using javascript/HTML/cgi/

    An explanation and a trick is given at http://support.microsoft.com/kb/222064/
    A page that Internet Explorer is browsing is not cached until half of the 64 KB buffer is filled. Usually, metatags are inserted in the header section of an HTML document, which appears at the beginning of the document. When the HTML code is parsed, it is read from top to bottom. When the <HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> metatag is read, Internet Explorer looks for the existence of the page in cache at that exact moment. If it is there, it is removed.

    To properly prevent the Web page from appearing in the cache, place another header section at the end of the HTML document. For example:

    <HTML>
    <HEAD>
    <META HTTP-EQUIV="REFRESH" CONTENT="5">
    <TITLE> Pragma No-cache </TITLE>
    </HEAD>
    <BODY>
    This is an example of where to place the second header section<br>
    so that the "Pragama, No-Cache" metatag will work as it is supposed to.<br>
    </BODY>
    <HEAD>
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    </HEAD>
    </HTML>

    Note that the <HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> metatag does not work with Internet Explorer 5.
    For old versions of Internet Explorer, it is possible to profit form a bug by which Internet Explorer does not load web pages that contain the euro character from the local cache, see http://support.microsoft.com/support.../Q256/3/04.ASP

    Additional information is given at http://support.microsoft.com/kb/234067/en-us.

  4. #4
    Join Date
    Sep 2005
    Posts
    10

    Re: clear the cache using javascript/HTML/cgi/

    I tried this with all combination but not working ....can u suggest some other way ... the suggestion in Javascript , CGI can also solve my problem

  5. #5
    Join Date
    Sep 2005
    Posts
    23

    Re: clear the cache using javascript/HTML/cgi/

    Hi,

    what do you want to do exactly?
    a) Want to clear the whole browser cache of a users browser? (Impossible)
    b) Prevent the browser from caching certain pages.

    I would have a look at the link I posted yesterday. You could add HTTP-Cache Control Headers to your pages with a server sided script (cgi / perl / php). Or you can configure your webserver to do so.

    Henning

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)