Where are importScripts files loaded from?

275 Views Asked by At

The MDN definition is pretty short:

The importScripts() method of the WorkerGlobalScope 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. Is foo.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>). Is foo.js loaded from memory? If not, where is it loaded from?
0

There are 0 best solutions below