URL

Experimental: Esta es una tecnología experimental
Comprueba la Tabla de compabilidad de navegadores cuidadosamente antes de usarla en producción.

La interfaz URL representa a un objeto que provee métodos estáticos para crear objetos URL.

When using a user agent where no constructor has been implemented yet, it is possible to access such an object using the Window.URL (en-US) properties (prefixed with Webkit-based browser as Window.webkitURL).

Nota: Esta característica está disponible en Web Workers

Properties

URL.href (en-US)

Is a DOMString containing the whole URL.

URL.protocol (en-US)

Is a DOMString containing the protocol scheme of the URL, including the final ':'.

URL.host

Is a DOMString containing the host, that is the hostname, a ':', and the port of the URL.

URL.hostname (en-US)

Is a DOMString containing the domain of the URL.

URL.port

Is a DOMString containing the port number of the URL.

URL.pathname (en-US)

Is a DOMString containing an initial '/' followed by the path of the URL.

URL.search (en-US)

Is a DOMString containing a '?' followed by the parameters of the URL.

URL.hash (en-US)

Is a DOMString containing a '#' followed by the fragment identifier of the URL.

URL.username (en-US)

Is a DOMString containing the username specified before the domain name.

URL.password (en-US)

Is a DOMString containing the password specified before the domain name.

URL.origin (en-US) Read only

Returns a DOMString containing the origin of the URL, that is its scheme, its domain and its port.

URL.searchParams (en-US)

Returns a URLSearchParams object allowing to access the GET query arguments contained in the URL.

Constructor

URL()

Creates and return a URL object composed from the given parameters.

Methods

The URL interface implements methods defined in URLUtils.

URLUtils.toString()

Returns a DOMString containing the whole URL. It is a synonym for URLUtils.href, though it can't be used to modify the value.

Static methods

URL.createObjectURL()

Returns a DOMString containing a unique blob URL, that is a URL with blob: as its scheme, followed by an opaque string uniquely identifying the object in the browser.

URL.revokeObjectURL() (en-US)

Revokes an object URL previously created using URL.createObjectURL().

Especificaciones

Specification
URL Standard
# api

Compatibilidad con navegadores

BCD tables only load in the browser

See also