URL: href property
{{ApiRef("URL API")}}
{{AvailableInWorkers}}
The href
property of the {{domxref("URL")}}
interface is
a string containing the whole URL.
Value
A string.
Examples
const url = new URL(
"https://developer.mozilla.org/en-US/docs/Web/API/URL/href",
);
console.log(url.href); // Logs: 'https://developer.mozilla.org/en-US/docs/Web/API/URL/href'
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- The
{{domxref("URL")}}
interface it belongs to.