WorkerLocation: origin property - Web APIs | MDN (original) (raw)

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