Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Chrome to reload a resource?

We're building a web-based visualization and I recently replaced the source file of an <audio /> element on the server with another file of a different size but same name.

When I reloaded the page in Chrome, the old sound was used. When I 'STRG+F5'ed the page, still the old sound was used. I then directly opened the mp3 file in the browser by navigating to the source URL of the audio element. Even then the old sound was used. I also tried opening the dev tools and disabled the cache - still the same.

With Firefox, the new sound was used after a forced refresh (Strg-F5), which is exactly the behaviour I expected to see. Any server-side caching is completely disabled, by the way.

What is Chrome doing here? Not that the sound file is the most important thing on earth (it is used programmatically as a warning sound), but I am a bit alarmed now that other resources may as well get "stuck in cache". Did someone run into the same issue?

like image 506
Rob Avatar asked Nov 07 '16 10:11

Rob


People also ask

How do I force a cache reload?

Press Ctrl+F5. In most browsers, pressing Ctrl+F5 will force the browser to retrieve the webpage from the server instead of loading it from the cache. Firefox, Chrome, Opera, and Internet Explorer all send a “Cache-Control: no-cache” command to the server.

How do I force a CSS file to reload?

All you have to do is to perform a hard or force-reload or empty the local cache if necessary. If you're using Chrome, you can force reload by pressing the F12 key to open the console. Then, right-click the reload button to access the menu containing the options for reloading.

What is Ctrl F5 in Chrome?

Ctrl F5 (or Ctrl + F5) reloads the current page including the browser cache. It's called Hard reload. It means that the browser will not use the current cache but will be forced to download again all the files (js files, images, scripts, …). You will have the most fresh version of the page sent by the server.


1 Answers

I ran over the same issue. I was debugging some CCS. The way I solved is: open developer console in chrome by pressing F12 then you are able to right click on refresh button and chose the third option (empty cache and hard reload). This will reload the page completely and should clear the cache. If you want to just relaod the page ignoring the cached content: ctrl + shift+r or ctrl + F5

For futher info check out this page.

Hope it helpes :)

like image 167
Jan Veselý Avatar answered Nov 15 '22 07:11

Jan Veselý