Prevent caching of HTML page [duplicate]

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();
});

Leave a Comment