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.
The WorkerLocation interface doesn't inherit any property, but implements properties defined in the URLUtilsReadOnly interface.
URLUtilsReadOnly.href Read only
DOMString containing the whole URL of the script executed in the Worker.URLUtilsReadOnly.protocol Read only
DOMString containing the protocol scheme of the URL of the script executed in the Worker, including the final ':'.URLUtilsReadOnly.host Read only
DOMString containing the host, that is the hostname, a ':', and the port of the URL of the script executed in the Worker.URLUtilsReadOnly.hostname Read only
DOMString containing the domain of the URL of the script executed in the Worker.URLUtilsReadOnly.origin Read only
DOMString containing the canonical form of the origin of the specific location.URLUtilsReadOnly.port Read only
DOMString containing the port number of the URL of the script executed in the Worker.URLUtilsReadOnly.pathname Read only
DOMString containing an initial '/' followed by the path of the URL of the script executed in the Worker.URLUtilsReadOnly.search Read only
DOMString containing a '?' followed by the parameters of the URL of the script executed in the Worker.URLUtilsReadOnly.hash Read only
DOMString containing a '#' followed by the fragment identifier of the URL of the script executed in the Worker.The WorkerLocation interface doesn't inherit any method, but implements methods defined in the URLUtilsReadOnly interface.
URLUtilsReadOnly.toString()DOMString containing the whole URL of the script executed in the Worker. It is a synonym for URLUtilsReadOnly.href.| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'WorkerLocation' in that specification. | Living Standard |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 1 | ? | 3.5 | ? | Yes | ? |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | ? | 4 | Yes | ? | Yes |
Worker, WorkerNavigator, and WorkerGlobalScope.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation