WorkerLocation
Web Workers APIworker
Web Workers APIworker
The WorkerLocation interface defines the absolute location of the script executed by the Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.location property obtained by calling self.location.
This interface is only visible from inside a JavaScript script executed in the context of a Web worker.
Instance properties
- WorkerLocation.href
- : Returns a string containing the serialized URL for the worker's location.
- WorkerLocation.protocol
- : Returns the protocol part of the worker's location.
- WorkerLocation.host
- : Returns the host part of the worker's location.
- WorkerLocation.hostname
- : Returns the hostname part of the worker's location.
- WorkerLocation.origin
- : Returns the worker's origin.
- WorkerLocation.port
- : Returns the port part of the worker's location.
- WorkerLocation.pathname
- : Returns the pathname part of the worker's location.
- WorkerLocation.search
- : Returns the search part of the worker's location.
- WorkerLocation.hash
- : Returns the hash part of the worker's location.
Instance methods
- WorkerLocation.toString()
- : Returns a string containing the serialized URL for the worker's location. It is a synonym for WorkerLocation.href.
Specifications
Browser compatibility
See also
- Other Worker-related interfaces: Worker, WorkerNavigator, and WorkerGlobalScope
- Using web workers