WorkerLocation: toString() method
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.
The toString() stringifier method of a WorkerLocation object returns a string containing the serialized URL for the worker's location. It is a synonym for WorkerLocation.href.
Syntax
js
toString()
Parameters
None.
Return value
None (undefined).
Examples
js
// In a Web worker, on the page https://big.rakal.top/en-US/docs/Web
const result = location.toString(); // Returns 'https://big.rakal.top/en-US/docs/Web'
Specifications
| Specification |
|---|
| HTML> # workerlocation> |
Browser compatibility
Loading…
See also
- The
WorkerLocationinterface it belongs to.