0

With JS and CSS, I've forced the reload for the new files with href="styles.css?v=1" and script src="scripts.js?v=1" in my code, but where / what do I write for it to force the reload of my HTML page? I've made changes but it's not picking them up unless I manually refresh/clear the cache, which is okay in my case but I can't control it when other people are looking at the my site.

Mariam15
  • 13
  • 2

2 Answers2

0

There 2 common approaches:

  1. set a meta no cache:

  2. Or set up your web server to add cache control policy

Danil Sabirov
  • 333
  • 2
  • 11
0

The link below the question is to a 10-year-old answer. I tried this, and it does not prevent Firefox using its cached page, ignoring updates on the server. I can't set up the server either – it's a free hosted site where I am trialling the work.

<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" />

Instructions on how to clear my own browser cache are well posted but irrelevant: I can't tell readers to clear their browser cache and it's a very blunt tool anyway – other pages will have their cache removed too.

But what does work very nicely is to rename my page from

index.html

to

index.php

It doesn't even contain any PHP code directly, although it does link to files that do.

However I am still wondering how the media solves the problem of making sure readers have up-to-date news.

Weather Vane
  • 33,872
  • 7
  • 36
  • 56