From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- files/es/web/api/url/createobjecturl/index.html | 148 ++++++++++++++++ files/es/web/api/url/host/index.html | 62 +++++++ files/es/web/api/url/index.html | 217 ++++++++++++++++++++++++ files/es/web/api/url/port/index.html | 55 ++++++ files/es/web/api/url/url/index.html | 99 +++++++++++ 5 files changed, 581 insertions(+) create mode 100644 files/es/web/api/url/createobjecturl/index.html create mode 100644 files/es/web/api/url/host/index.html create mode 100644 files/es/web/api/url/index.html create mode 100644 files/es/web/api/url/port/index.html create mode 100644 files/es/web/api/url/url/index.html (limited to 'files/es/web/api/url') diff --git a/files/es/web/api/url/createobjecturl/index.html b/files/es/web/api/url/createobjecturl/index.html new file mode 100644 index 0000000000..9a6b6841b4 --- /dev/null +++ b/files/es/web/api/url/createobjecturl/index.html @@ -0,0 +1,148 @@ +--- +title: URL.createObjectURL() +slug: Web/API/URL/createObjectURL +tags: + - API + - Experimental + - Method + - URL + - URL API + - createObjectURL +translation_of: Web/API/URL/createObjectURL +--- +

{{ApiRef("URL")}}{{SeeCompatTable}}

+ +

El método estático URL.createObjectURL() crea un {{domxref("DOMString")}} que contiene una URL que representa al objeto pasado como parámetro. La vida de la URL está ligado al {{domxref("document")}} de la ventana en la que fue creada. El nuevo objeto URL representa al objeto {{domxref("File")}} especificado o al objeto {{domxref("Blob")}}.

+ +
+

El uso de un objeto {{domxref("MediaStream")}} como entrada a este método está en proceso de ser obsoleto. Las discusiones están en curso sobre si o no debe ser quitado totalmente. Como tal, se debe de evitar usar este método con  {{domxref("MediaStream")}}s, y se debería usar {{domxref("HTMLMediaElement.srcObject", "HTMLMediaElement.srcObject()")}}.

+
+ +

{{AvailableInWorkers}}

+ +

Sintaxis

+ +
objectURL = URL.createObjectURL(object);
+
+ +

Parámetros

+ +
+
object
+
Un objeto {{domxref("File")}} o un objeto {{domxref("Blob")}} para el que se creará la URL.
+
+ + + +

Ejemplo

+ +

Ver Usando objetos URL para representar imágenes.

+ +

Notas

+ +

Cada vez que se llama a createObjectURL(), un nuevo objeto URL es creado, incluso si ya creaste uno para el mismo objeto. Cada uno de estos objetos puede ser liberado usando {{domxref("URL.revokeObjectURL()")}} cuándo ya no lo necesitas. Los navegadores liberan estos objetos cuando el documento es cerrado; de todas formas, para obtener un rendimiento óptimo y un óptimo uso de memoria, si hay momentos seguros en los que puedes liberar estos objetos deberías hacerlo. Por ejemplo: No liberar los recursos cuando se ha creado una URL a partir de un {{domxref('MediaStream')}} puede dejar la luz de la cámara del navegador encendida más tiempo del necesario.

+ +
+

Notese que no es necesario crear URLs a partir de un {{domxref('MediaStream')}}, ya que los objetos de streams deberían asignarse directamente a elementos de reproducción con {{domxref("HTMLMediaElement.srcObject")}}. La posibilidad de usar un MediaStream como valor de un objeto está obsoleta.

+
+ +

Especificaciones

+ + + + + + + + + + + + + + +
EspecificaciónEstadoComentario
{{SpecName('File API', '#dfn-createObjectURL', 'URL')}}{{Spec2('File API')}}Definición inicial.
+ +

Compatibilidad de navegadores

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Soporte básico8 [1]
+ {{CompatChrome(23)}}
{{CompatGeckoDesktop(2)}}{{CompatIE(10)}}{{CompatOpera(15)}}{{CompatSafari(6)}} [1]
+ {{CompatSafari(7)}}
In a {{ domxref("Worker", "Web Worker") }}10 [1]
+ {{CompatChrome(23)}}
{{CompatGeckoDesktop(21)}}{{CompatIE(11)}}{{CompatOpera(15)}}{{CompatSafari(6)}} [1]
+ {{CompatSafari(7)}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CaracterísticaChrome para AndroidAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Soporte básico18 [1]4.0 [1]{{CompatGeckoMobile(14)}}{{CompatUnknown}}{{CompatOpera(15)}} [1]6.0 [1]
In a {{ domxref("Worker", "Web Worker") }}18 [1]{{CompatVersionUnknown}} [1]{{CompatGeckoMobile(14)}}{{CompatUnknown}}{{CompatOpera(15)}} [1]6.0 [1]
+
+ +

[1] Con URL prefijado como webkitURL

+ +

Mirar también

+ + diff --git a/files/es/web/api/url/host/index.html b/files/es/web/api/url/host/index.html new file mode 100644 index 0000000000..f18934e6a6 --- /dev/null +++ b/files/es/web/api/url/host/index.html @@ -0,0 +1,62 @@ +--- +title: Estabilidad +slug: Web/API/URL/Host +translation_of: Web/API/URL/host +--- +
{{ApiRef("URL API")}}
+ +

The host property of the {{domxref("URL")}} interface is a {{domxref("USVString")}} containing the host, that is the {{domxref("URL.hostname", "hostname")}}, and then, if the {{glossary("port")}} of the URL is nonempty, a ':', followed by the {{domxref("URL.port", "port")}} of the URL.

+ +

{{AvailableInWorkers}}

+ +

Syntax

+ +
const host = url.host
+url.host = newHost
+
+ +

Value

+ +

A {{domxref("USVString")}}.

+ +

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"
+
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('URL', '#dom-url-host', 'URL.host')}}{{Spec2('URL')}}Initial definition
+ +

Browser compatibility

+ + + +

{{Compat("api.URL.host")}}

+ +

See also

+ + diff --git a/files/es/web/api/url/index.html b/files/es/web/api/url/index.html new file mode 100644 index 0000000000..c107b21511 --- /dev/null +++ b/files/es/web/api/url/index.html @@ -0,0 +1,217 @@ +--- +title: URL +slug: Web/API/URL +tags: + - API + - Experimental + - Expérimental(2) + - NeedsTranslation + - TopicStub + - URL API +translation_of: Web/API/URL +--- +
{{ApiRef("URL API")}} {{SeeCompatTable}}
+ +

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 {{domxref("Window.URL")}} properties (prefixed with Webkit-based browser as Window.webkitURL).

+ +

{{AvailableInWorkers}}

+ +

Properties

+ +
+
{{domxref("URL.href")}}
+
Is a {{domxref("DOMString")}} containing the whole URL.
+
{{domxref("URL.protocol")}}
+
Is a {{domxref("DOMString")}} containing the protocol scheme of the URL, including the final ':'.
+
{{domxref("URL.host")}}
+
Is a {{domxref("DOMString")}} containing the host, that is the hostname, a ':', and the port of the URL.
+
{{domxref("URL.hostname")}}
+
Is a {{domxref("DOMString")}} containing the domain of the URL.
+
{{domxref("URL.port")}}
+
Is a {{domxref("DOMString")}} containing the port number of the URL.
+
{{domxref("URL.pathname")}}
+
Is a {{domxref("DOMString")}} containing an initial '/' followed by the path of the URL.
+
{{domxref("URL.search")}}
+
Is a {{domxref("DOMString")}} containing a '?' followed by the parameters of the URL.
+
{{domxref("URL.hash")}}
+
Is a {{domxref("DOMString")}} containing a '#' followed by the fragment identifier of the URL.
+
{{domxref("URL.username")}}
+
Is a {{domxref("DOMString")}} containing the username specified before the domain name.
+
{{domxref("URL.password")}}
+
Is a {{domxref("DOMString")}} containing the password specified before the domain name.
+
{{domxref("URL.origin")}} {{readonlyInline}}
+
Returns a {{domxref("DOMString")}} containing the origin of the URL, that is its scheme, its domain and its port.
+
+ +
+
{{domxref("URL.searchParams")}}
+
Returns a {{domxref("URLSearchParams")}} object allowing to access the GET query arguments contained in the URL.
+
+ +

Constructor

+ +
+
{{domxref("URL.URL", "URL()")}}
+
Creates and return a URL object composed from the given parameters.
+
+ +

Methods

+ +

The URL interface implements methods defined in {{domxref("URLUtils")}}.

+ +
+
{{domxref("URLUtils.toString()")}}
+
Returns a {{domxref("DOMString")}} containing the whole URL. It is a synonym for {{domxref("URLUtils.href")}}, though it can't be used to modify the value.
+
+ +

Static methods

+ +
+
{{domxref("URL.createObjectURL()")}}
+
Returns a {{domxref("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.
+
{{domxref("URL.revokeObjectURL()")}}
+
Revokes an object URL previously created using {{domxref("URL.createObjectURL()")}}.
+
+ +

Specifications

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('File API', '#creating-revoking', 'URL')}}{{Spec2('File API')}}Added the static methods URL.createObjectURL() and URL.revokeObjectURL().
{{SpecName('URL', '#api', 'Node')}}{{Spec2('URL')}}Initial definition (implements URLUtils).
+ +

Browser compatibility

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support8.0[2]
+ 32
In Development[5]{{CompatGeckoDesktop("2.0")}}[1][3]
+ {{CompatGeckoDesktop("19.0")}}
{{CompatNo}}[4]15.0[2]
+ 19
6.0[2]
+ 7.0
username, password, and origin32{{CompatUnknown}}{{CompatGeckoDesktop("26.0")}}{{CompatUnknown}}19{{CompatVersionUnknown}}
searchParams{{CompatChrome(49)}}{{CompatUnknown}}{{CompatGeckoDesktop("29.0")}}{{CompatUnknown}}36{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support4[2]
+ 4.4
8.0[2]
+ 32
{{CompatGeckoMobile("14.0")}}[1][3]
+ {{CompatGeckoMobile("19.0")}}
{{CompatVersionUnknown}}15.0[2]6.0[2]
username, password, and origin4.432{{CompatGeckoDesktop("26.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}
searchParams{{CompatNo}}{{CompatChrome(49)}}{{CompatGeckoMobile("29.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] From Gecko 2 (Firefox 4) to Gecko 18 included, Gecko supported this interface with the non-standard nsIDOMMozURLProperty internal type. As the only to access such an object was through {{domxref("window.URL")}}, in practice, this didn't make any difference.

+ +

[2] This feature is implemented under the non-standard name webkitURL.

+ +

[3] For Firefox, to use from chrome code, JSM and Bootstrap scope, you have to import it like this:

+ +
Cu.importGlobalProperties(['URL']);
+
+ +

URL is available in Worker scopes.

+ +

[4] As of IE11, instantiating new URL objects is not supported - ie. new URL() does not work. 

+ +

[5] Edge in development: see https://developer.microsoft.com/en-us/microsoft-edge/platform/status/urlapi/  and https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/6263638-url-api

+ +

See also

+ + diff --git a/files/es/web/api/url/port/index.html b/files/es/web/api/url/port/index.html new file mode 100644 index 0000000000..fea61df62a --- /dev/null +++ b/files/es/web/api/url/port/index.html @@ -0,0 +1,55 @@ +--- +title: URL.port +slug: Web/API/URL/port +translation_of: Web/API/URL/port +--- +
{{ApiRef("URL API")}}
+ +

La propiedad port de la interfaz {{domxref("URL")}} es un {{domxref("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á ''.

+ +

{{AvailableInWorkers}}

+ +

Sintaxis

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

Valor

+ +

Un {{domxref("USVString")}}.

+ +

Ejemplos

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

Especificaciones

+ + + + + + + + + + + + + + +
EspecificaciónEstadoComentario
{{SpecName('URL', '#dom-url-port', 'URL.port')}}{{Spec2('URL')}}Definición inicial.
+ +

Compatibilidad del navegador

+ + + +

{{Compat("api.URL.port")}}

+ +

Ver también

+ + diff --git a/files/es/web/api/url/url/index.html b/files/es/web/api/url/url/index.html new file mode 100644 index 0000000000..978a7de9f9 --- /dev/null +++ b/files/es/web/api/url/url/index.html @@ -0,0 +1,99 @@ +--- +title: URL() +slug: Web/API/URL/URL +translation_of: Web/API/URL/URL +--- +
{{APIRef("URL API")}}
+ +

El constructor URL() devuelve un objeto {{domxref("URL")}} recién creado que representa la URL definida por los parámetros.

+ +

Si la URL base dada o la URL resultante no son URL válidas, se lanza un {{domxref("DOMException")}}  de tipo SYNTAX_ERROR.

+ +

{{AvailableInWorkers}}

+ +

Sintaxis

+ +
url = new URL(url, [base])
+
+ +

Parámetros

+ +
+
url
+
Un {{domxref("USVString")}} que representa una URL absoluta o relativa. Si url es una URL relativa, se requiere base, y se usará como URL base. Si url es una URL absoluta, se ignorará una base determinada.
+
base {{optional_inline}}
+
Un {{domxref("USVString")}} representa la URL base a usar en caso de que la URL sea una URL relativa. Si no se especifica, el valor predeterminado es ''.
+
+ +
+

Nota: Aún puede usar un objeto {{domxref("URL")}} existente para la base, que se enchufa al atributo  {{domxref("DOMString.href","href")}} del objeto.

+
+ +

Excepciones

+ + + + + + + + + + + + + + +
ExcepciónExplicación
TypeErrorurl (en el caso de URL absolutas) o base + url (en el caso de URL relativas) no es una URL válida.
+ +

Ejemplos

+ +
// Urls base
+var m = 'https://developer.mozilla.org';
+var a = new URL("/", m);                                // => 'https://developer.mozilla.org/'
+var b = new URL(m);                                     // => 'https://developer.mozilla.org/'
+
+        new URL('en-US/docs', b);                      // => 'https://developer.mozilla.org/en-US/docs'
+var d = new URL('/en-US/docs', b);                     // => 'https://developer.mozilla.org/en-US/docs'
+        new URL('/en-US/docs', d);                     // => 'https://developer.mozilla.org/en-US/docs'
+        new URL('/en-US/docs', a);                     // => 'https://developer.mozilla.org/en-US/docs'
+
+        new URL('/en-US/docs', "https://developer.mozilla.org/fr-FR/toto");
+                                                       // => 'https://developer.mozilla.org/en-US/docs'
+
+        new URL('/en-US/docs', '');                    // Provoca una excepción TypeError ya que '' no es una URL válida
+        new URL('/en-US/docs');                        // Provoca una excepción TypeError ya que '/en-US/docs' no es una URL válida
+        new URL('http://www.example.com', );           // => 'http://www.example.com/'
+        new URL('http://www.example.com', b);          // => 'http://www.example.com/'
+
+        new URL("//foo.com", "https://example.com")    // => 'https://foo.com' (ver URL relativas)
+
+ +

Especificación

+ + + + + + + + + + + + + + +
EspecificaciónEstadoComentario
{{SpecName('URL', '#constructors', 'URL.URL()')}}{{Spec2('URL')}}Initial definition.
+ +

Compatibilidad del navegador

+ + + +

{{Compat("api.URL.URL")}}

+ +

Ver también

+ + -- cgit v1.2.3-54-g00ecf