How to disable page caching Disable page caching in multiple languages

WBOY
Release: 2016-07-25 08:51:41
Original
1138 people have browsed it
  1. Response.Buffer = True
  2. Response.ExpiresAbsolute = Now() - 1
  3. Response.Expires = 0
  4. Response.CacheControl = "no-cache"
  5. Response.AddHeader "Pragma", "No-Cache"
Copy the code

2. Add it to the html code

Copy code

3. Pass a parameter to the page when re-calling the original page Href="****.asp?random()"

The first two methods are said to fail sometimes, while the third method is to pass a random parameter when jumping! Because aspx's cache is related to parameters, if the parameters are different, the cache will not be used, but the page will be regenerated. Passing a random parameter each time can avoid using the cache. This only applies to asp&asp.net

4. Disable caching in jsp pages:

  1. response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
  2. response.setHeader("Pragma","no-cache"); //HTTP 1.0
  3. response. setDateHeader ("Expires", 0); //prevents caching at the proxy server
Copy the code

add these codes in the middle of

:
  1. <%
  2. response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
  3. response.setHeader("Pragma","no-cache" ; replace("WebForm1.aspx"); The parameter is the page to be covered.
  4. The principle of replace: Use the current page to replace the page specified by the replace parameter. This prevents the user from hitting the back key.
javascript script, examples are as follows: a.html

a

  • b
  • Copy code
  • b.html
  • b

  • a
  • Copy code
  • 6. PHP disable page caching
  • # Let it "expire" in the pastheader("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    # Always modified

    header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

    # HTTP/1.1

    header("Cache-Control: no-store, no-cache, must-revalidate");
      header("Cache-Control: post-check=0, pre-check=0", false);

    1. # HTTP/1.0

    2. header("Pragma: no-cache");

    3. Copy code
    4. >>>> Articles you may be interested in: Parsing PHP and browser caching mechanism Example of how to immediately refresh cached output in php Example of php page caching (reducing the burden on cpu and mysql) How to disable client-side caching of aspx pages Introduction to how to cancel the cache of asp.net How to clear IE page cache for asp.net Summary of methods to clear IE cache (asp asp.net php, etc.) asp Introduction to clearing IE cache php prohibits page caching output code php code to disable page caching A php function to disable page caching How to prevent IE from caching jsp files Analysis of ASP.NET caching methods asp.net performance optimization method-caching data and page output



  • source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template