Prevent caching of HTML page

This question already has an answer here:

  • How to control web page caching, across all browsers? 26 answers

  • The values you have there are OK, but meta http-equiv is highly unreliable. You should be using real HTTP headers (the specifics of how you do this will depend on your server, eg for Apache).


    The Codesnippet you showed makes the browser load the website everytime it accesses it, which is useful if you perform frequent updates, but still have a static page.

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="Expires" content="0"/>
    

    In case you want it to perform live updates , like it does for example in a (g)mail account, you need to make it refresh (parts of the page) itself. Use Javascript in this case, like it is shown in this question or an ajax call.

    $('#something').click(function() {
        location.reload();
    });
    
    链接地址: http://www.djcxy.com/p/28680.html

    上一篇: 在jQuery中存在一定的延迟后刷新页面

    下一篇: 防止HTML页面的缓存