-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
40 lines (26 loc) · 888 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: "WorkerLocation: toString() method"
short-title: toString()
slug: Web/API/WorkerLocation/toString
page-type: web-api-instance-method
browser-compat: api.WorkerLocation.toString
---
{{ApiRef("WorkerLocation")}}
The **`toString()`** {{Glossary("stringifier")}} method of a {{domxref("WorkerLocation")}} object returns a string containing the serialized {{domxref("URL")}} for the worker's location. It is a synonym for {{domxref("WorkerLocation.href")}}.
## Syntax
```js-nolint
toString()
```
### Parameters
None.
### Return value
None ({{jsxref("undefined")}}).
## Examples
```js
// In a Web worker, on the page https://developer.mozilla.org/en-US/docs/Web
const result = location.toString(); // Returns 'https://developer.mozilla.org/en-US/docs/Web'
```
## Browser compatibility
{{Compat}}
## See also
- The {{domxref("WorkerLocation")}} interface it belongs to.