web api instance method
URL: toString() method
Available in workers
The toString() method of the URL interface returns a
string containing the whole URL. It is effectively a read-only version
of href.
Syntax
toString()
Parameters
None.
Return value
A string.
Examples
const url = new URL(
"https://developer.mozilla.org/en-US/docs/Web/API/URL/toString",
);
url.toString(); // should return the URL as a string
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- The
URLinterface it belongs to.