WorkerLocation: origin 屬性

Baseline 已廣泛支援

此特性已非常成熟,可在多種裝置和瀏覽器版本上使用。自 ⁨2016 年 9 月⁩以來,它已在各大瀏覽器中可用。

注意:此功能僅在 Web Workers 中可用。

WorkerLocation 物件的 origin 屬性返回 worker 的 origin

字串。

示例

js
// On this page, returns the origin
const result = self.location.origin; // Returns:'https://mdn.club.tw:443'

規範

規範
HTML
# dom-workerlocation-origin

瀏覽器相容性

另見