Breck
Breck

Reputation: 690

Is there a way to force the browser to load a link without hitting cache?

I can easily make the browser always request the latest version of a page by appending a timestamp to the query string, for example:

onclick="window.open('index.html?t=12343542436')"

Is there a way that I could do that without messing with the url? (Which is ugly from a UI point of view--makes sharing links harder)

Upvotes: 0

Views: 142

Answers (1)

Simon Boudrias
Simon Boudrias

Reputation: 44649

Set your server to send cache controls HTTP headers with .html file type.

For example, in Apache:

<IfModule mod_expires.c>
  ExpiresByType text/html     "access plus 0 seconds"
</IfModule>

There's similar config in every server (and even in programming language like PHP or Node.js, etc)

Here an article speaking in depth of the cache related HTTP headers: http://www.mobify.com/blog/beginners-guide-to-http-cache-headers/

Upvotes: 2

Related Questions