Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.

View in English Always switch to English

URL.port

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨septiembre de 2016⁩.

La propiedad port de la interfaz URL es un USVString que contiene el número de puerto de la URL. Si la URL no contiene un número de puerto explícito, se establecerá ''.

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

Sintaxis

string = object.port;
object.port = string;

Valor

Un USVString.

Ejemplos

js
var url = new URL("https://mydomain.com:80/svn/Repos/");
var result = url.port; // Devuelve:'80'

Especificaciones

Specification
URL
# dom-url-port

Compatibilidad con navegadores

Ver también

  • La interfaz URL a la que pertenece.