WorkerLocation: phương thức toString()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Note: This feature is only available in Web Workers.

Phương thức stringifier toString() của đối tượng WorkerLocation trả về một chuỗi chứa URL đã được tuần tự hóa cho vị trí của worker. Đây là từ đồng nghĩa với WorkerLocation.href.

Cú pháp

js
toString()

Tham số

Không có.

Giá trị trả về

Không có (undefined).

Ví dụ

js
// Trong một Web worker, trên trang https://mdn.go-mizu.dev/vi/docs/Web
const result = location.toString(); // Trả về 'https://mdn.go-mizu.dev/vi/docs/Web'

Thông số kỹ thuật

Specification
HTML
# workerlocation

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

Xem thêm