web api interface
WorkerLocation
Available in workers
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 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
hrefRead only- : Returns a string containing the serialized
URLfor the worker’s location.
- : Returns a string containing the serialized
protocolRead only- : Returns the
protocolpart of the worker’s location.
- : Returns the
hostRead only- : Returns the
hostpart of the worker’s location.
- : Returns the
hostnameRead only- : Returns the
hostnamepart of the worker’s location.
- : Returns the
originRead only- : Returns the worker’s
origin.
- : Returns the worker’s
portRead only- : Returns the
portpart of the worker’s location.
- : Returns the
pathnameRead only- : Returns the
pathnamepart of the worker’s location.
- : Returns the
searchRead only- : Returns the
searchpart of the worker’s location.
- : Returns the
hashRead only- : Returns the
hashpart of the worker’s location.
- : Returns the
Instance methods
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- Other Worker-related interfaces:
Worker,WorkerNavigator, andWorkerGlobalScope - Using web workers