css: set PRE’s max-width so it doesn’t stretch the viewport
[mina86.com.git] / posts / til-expires-header.en.html
blobdfcb99adc75d5f4ab228da3afd52172f81a20c35
1 <!-- subject: TIL: Browsers ignore <code>Expires</code> header on reload -->
2 <!-- date: 2019-02-26 13:11:55 -->
3 <!-- tags: expires, cache-control, http -->
4 <!-- categories: Articles, Techblog -->
6 <p>This may have been obvious, but I’ve just learned that browsers
7 ignore <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires">Expires</a>
8 header when the user manually reloads the page (as in by pressing F5 or
9 choosing Reload option).
11 <p>I’ve run into this when testing how Firefox treats pages which ‘never’
12 expire. To my surprise, the browser made requests for files it had a fresh
13 copy of in its cache. To see behaviour much more representative of the
14 experience of a returning user, one should select the address bar (Alt+D does
15 the trick) and then press Return to navigate to the current page again.
16 Hitting Reload is more akin, though not exactly the same, to the first visit.
18 <p>Of course, all of the above applies to the <code>max-age</code> directive of
19 the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control">Cache-Control</a>
20 header as well.
22 <p>Moral of the story? Make sure you test the actual real-life scenarios before
23 making any decisions.
25 <!-- COMMENT -->
26 <!-- date: 2019-07-10 19:51:16 -->
27 <!-- nick: Alex Rudenko -->
28 <!-- nick_url: https://twitter.com/orKoN -->
29 <!-- nick_email: nyrkrv.ehqraxb@tznvy.pbz -->
31 <p>I often have problems with cache invalidation in the browsers especially if I use service workers. The latest problem for me was that the browser wouldn't not refresh even on reload because of a badly written service worker.