Skip to content Skip to sidebar Skip to footer

Web Worker: How To Prevent That File Gets Loaded From Cache?

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: I have d

Solution 1:

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

_worker = new Worker('js/toy-cpu.js?v=' + new Date().getTime());

Solution 2:

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.


Post a Comment for "Web Worker: How To Prevent That File Gets Loaded From Cache?"