A WebWorker executes with a scope completely separate from the \'window\' context of traditional JavaScript. Is there a standard way for a script to determine if it is, its
The spec says:
The DOM APIs (Node objects, Document objects, etc) are not available to workers in this version of this specification.
This suggests checking for the absence of document is a good way to check you're in a worker. Alternatively you could try checking for the presence of WorkerGlobalScope?