The MDN definition is pretty short:
The
importScripts()
method of theWorkerGlobalScope
interface 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.js
is not cached and not loaded on page by someone else. Isfoo.js
loaded from disk?foo.js
is cached. Probably it's loaded from cache, right?foo.js
is loaded on page already (using<script src="foo.js"></script>
). Isfoo.js
loaded from memory? If not, where is it loaded from?