WorkerLocation: thuộc tính origin

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.

Thuộc tính origin của đối tượng WorkerLocation trả về origin của worker.

Giá trị

Một chuỗi.

Ví dụ

js
// Trên trang này, trả về origin
const result = self.location.origin; // Trả về:'https://mdn.go-mizu.dev:443'

Thông số kỹ thuật

Thông số kỹ thuật
HTML
# dom-workerlocation-origin

Tương thích trình duyệt

Xem thêm