3

This is incredibly annoying.. I am wondering why the heck my changes aren't reflected as I notice that my JavaScript file for my Web Worker always gets loaded from cache:

enter image description here

I have disabled the Cache and hitting Ctrl + F5 does not work either.

How can I make sure that this file does not get loaded from cache?

_worker = new Worker('js/toy-cpu.js');
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
  • Possible duplicate of [Why won't the client receive new versions of this script in the public folder?](http://stackoverflow.com/questions/28573129/why-wont-the-client-receive-new-versions-of-this-script-in-the-public-folder) – Michal Charemza Oct 28 '15 at 09:43

2 Answers2

0

You could add a kind of version number, for example like this:

_worker = new Worker('js/toy-cpu.js?v=' + new Date().getTime());
trincot
  • 317,000
  • 35
  • 244
  • 286
  • Okay, that would be my last solution if there is no other way to do it since it is surely faster than deleting the cache manually all the time. But I'd still would want my browser to *not* use the cache here. I think I'm not looking for the programmatic solution for a way out but if it can't be helped.. – Stefan Falk Oct 26 '15 at 22:19
  • Then you get into browser-specific areas which cannot be controlled from within Javascript. – trincot Oct 26 '15 at 22:37
-1

If you are looking for the purposes of development / the configuration of your personal machine.. rather than that every user needs it to load from the web server.

Chrome has an option to disable cache

enter image description here

Notice the checkbox "disable cache" that you can check as I have.

And in the section below, where it says "Perform a request". if you refresh then you see the page listed, and it can indicate whether a URL is loaded from the web server, if chrome says 200 and if in the size column it gives size as a number, then it loaded from the web server. And if you double click a URL in the inspector, you see HTTP Headers.

barlop
  • 12,887
  • 8
  • 80
  • 109