Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force browser to reload index.htm

how can I force a browser to always load the newest version of index.htm when the page is loaded by entering the URL www.mydomain.com/index.htm or just www.mydomain.com in the browser's address field and pressing enter.

I'm trying this in Chrome and the newest version of index.htm is apparently only loaded, when I refresh manually (F5), or when the URL is already in the browser's address field and I press enter.

I guess I am doing something extremely stupid, because when I searched for the issue, all I could find were solutions about how to make a browser reload your .js and .css files by appending ?v=xxxx to the file names. But how should this work, if not even the newest version of index.htm page, in which I am doing these modifiactions, is loaded??

I also tried putting

<meta http-equiv="cache-control" content="no-cache"> 

in the <head> of index.htm. But this does not seem to have any effect.

Any help would be greatly appreciated!

Thanks, Linus

like image 330
Linus Avatar asked Nov 08 '14 14:11

Linus


People also ask

How do I force a HTML page to refresh?

In most web browsers you can force a one-time page load from the server by holding down the shift key while clicking on the Reload or Refresh button.

How do I force a browser to refresh a page?

Ctrl + F5 is the shortcut to trigger a refresh, which will force the page to reload. To make the browser refresh without relying on the cache, use Shift + Ctrl + F5. This triggers a “hard refresh”, so the browser pulls up the newest version of a web page.

How do I force a browser to reload a script?

Clear the cache or force reload in the browser. Hit CTRL-F5 or CTRL-SHIFT-R in most modern browsers to force reload. Use the developer’s console to clear the cache. Do it programmatically. Change the file name of the script. Append a dummy timestamp to the source URL. Set an HTTP expires header to encourage browsers to reload the script.

How do I force a page to reload from the server?

In most modern browsers – Hold the CONTROL key ( COMMAND on a Mac), then click on the reload button. That’s it, this will force a full page reload from the server, not use anything from the local cache. The “common shortcut key” to do force-reload is either CONTROL-F5 or CONTORL-SHIFT-R. Now, the following is only for the Google Chrome browser.

Why is my website loading files from the browser?

Another possibility, however, is that the browser is loading the page from its cache rather than the server where the new file is sitting. If you are concerned about your web pages caching for your site's visitors, you can tell the web browser not to cache a page, or indicate how long the browser should cache the page.

How do I force-reload a page?

BROWSER FULL RELOAD PAGE 1 In most modern browsers – Hold the CONTROL key ( COMMAND on a Mac), then click on the reload button. That’s it, this... 2 The “common shortcut key” to do force-reload is either CONTROL-F5 or CONTORL-SHIFT-R. More ...


1 Answers

OK, apparently no-cache was not enough. The following does the trick:

  <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" /> 
like image 83
Linus Avatar answered Sep 26 '22 02:09

Linus