Old Cache Buster techniques I have found to date are:
- Query String in the link src: /mstylesheet.css?cache_buster=12345
- Change the filename each time: /mstylesheet-12345.css
- Apache: Cache-Control "must-revalidate" in conjunction with no-cache
I've noticed problems with all of these where stubborn Browser caches refuse to get updated assets ?
If I've understood correctly, the browser cache appears to treat the following URLs as completely different entities ?
- /mstylesheet.css
- /mstylesheet.css?cache_buster=12345
- /mstylesheet.css?cache_buster=54321
So the question is: Would the following javascript work to force an existing stylesheet, linked via a link tag, without a cache buster query string, to be updated in the browser cache ?
fetch("/mstylesheet.css",{ method: "GET",headers: {"Cache-Control": "no-cache"}});
(I'd want to have this run a one off every now and then. Not on every page load).