WorkerLocation: origin property
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since â¨September 2016â©.
Note: This feature is only available in Web Workers.
The origin property of a WorkerLocation object returns the worker's origin.
Value
A string.
Examples
js
// On this page, returns the origin
const result = self.location.origin; // Returns:'https://developer.mozilla.org:443'
Specifications
| Specification |
|---|
| HTML > # dom-workerlocation-origin > |
Browser compatibility
See also
- The
WorkerLocationinterface it belongs to.