2

I need to find a HTML sequence that always disables caching in the browser when accessing the page containing the HTML sequence. My most recent attempt (which still fails sometimes) is below - failing being defined as caching where the browser renders a previous version of the page (after the page file or some referenced file such as a graphic image file was modified in the local server).

The operative word in this is "sometimes" - my attempts at disabling caching seem to work, but not always, and that's the hitch.

Why? This (unwanted caching) makes development (where the HTML files change in some way per iteration) very inconvenient because the browser sometimes (but not always) renders a previously stored version of a page.

Yes, I know disabling caching makes rendering slow, but slow and seeing changes is much better than fast and not seeing changes and then having to go into the browser options to clear cache (aargh!)

This is for a small, simple, closed (not going out on the Internet), single-user function.

The application is based on HTML web pages, that will ONLY be used with firefox browser (no other browser, firefox version or OS need be supported).

The server is IIS "out of the box" except for the addition of the index.html file and path to the set of pages served by IIS. The OS is Windows 10 64-bit.

The (only) client is Firefox 64-bit current version (it updates from time to time and is current). No javascript is possible, only HTML and CSS.

My html files all begin with this sequence:

<!DOCTYPE html>
<html>
<head>
<!-- force browser to reload every time -->
<meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<style>
...
(and so on)

I cannot change browser settings to disable caching, as the browser is used for other purposes as well.

I cannot change server (IIS) settings.

I CANNOT use javascript in any way, shape or form to solve this problem, because the application is going to be solely HTML + CSS.

I cannot introduce any other server-side programming language or environment (just HTML files edited by hand.)

I can supply further information if that would help isolate the issue.

If this is not the correct place to pose this question, or I've not formed the question properly, please point that out, hopefully with guidance as to how to help me get help.

Thank you!

wb0gaz
  • 43
  • 1
  • 7
  • 1
    Have a read of [this](https://stackoverflow.com/a/1341133/4517781) – Jacob Sánchez Nov 10 '19 at 02:34
  • Quote: _[...] the second would overwrite the first and the fourth would overwrite the third because of the http-equiv declaration_ – Jacob Sánchez Nov 10 '19 at 02:36
  • I think you can press ctrl+f5 or ctrl+[click refresh button] to do a new request. Or I'm sure there's a browser extension that'll help with what you want. Idk about changes to the html/css. – Reed Nov 10 '19 at 03:00
  • Not a great solution but if it really is a caching issue, you could try adding meaningless get params to the url to fetch a new copy. mysite.sometld?a=7 then a=93, dog=cat or whatever as long as it changes. Disabling caching on your dev browser is probably the way to go. There's probably a way to disable caching for an entire site or for all sites or you could download the developer version of firefox and leave caching settings normal on the consumer install (i think you can have both in parallel) https://www.mozilla.org/en-US/firefox/developer/ – Reed Nov 10 '19 at 03:07

1 Answers1

1

Why? This (unwanted caching) makes development (where the HTML files change in some way per iteration) very inconvenient

Simply open your browser's developer tools. By default, this disables caching. There'll be a checkbox for disabling caching here, if you've changed it in the past.

Brad
  • 159,648
  • 54
  • 349
  • 530