The MDN definition is pretty short:
The
importScripts()method of theWorkerGlobalScopeinterface imports one or more scripts into the worker's scope.
When using importScripts("foo.js"), where is foo.js loaded from? I would like to know what happens in the following cases:
foo.jsis not cached and not loaded on page by someone else. Isfoo.jsloaded from disk?foo.jsis cached. Probably it's loaded from cache, right?foo.jsis loaded on page already (using<script src="foo.js"></script>). Isfoo.jsloaded from memory? If not, where is it loaded from?