Estabilidad
The host
property of the URL
interface is a USVString
(en-US) containing the host, that is the hostname
(en-US), and then, if the port of the URL is nonempty, a ':'
, followed by the port
of the URL.
Nota: Esta característica está disponible en Web Workers
Syntax
const host = url.host url.host = newHost
Value
Examples
let url = new URL('https://developer.mozilla.org/en-US/docs/Web/API/URL/host');
console.log(url.host); // "developer.mozilla.org"
url = new URL('https://developer.mozilla.org:443/en-US/docs/Web/API/URL/host');
console.log(url.host); // "developer.mozilla.org"
// The port number is not included because 443 is the scheme's default port
url = new URL('https://developer.mozilla.org:4097/en-US/docs/Web/API/URL/host');
console.log(url.host); // "developer.mozilla.org:4097"
Especificaciones
Specification |
---|
URL Standard # dom-url-host |
Compatibilidad con navegadores
BCD tables only load in the browser
See also
- The
URL
interface it belongs to.