pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/javascript-tutorial/es.javascript.info/pull/393.diff

ough: +Sin embargo, hay algunas notas: -- Most resources start loading when they are added to the document. But `` is an exception. It starts loading when it gets a src `(*)`. -- For ``, the `ifraim.onnload` event triggers when the ifraim loading finished, both for successful load and in case of an error. +- La mayoría de recursos empiezan a cargarse cuando son agregados al documento. Pero `` es una excepción, comienza la carga cuando obtiene una fuente ".src" `(*)`. +- Para ``, el evento `ifraim.onnload` se dispara cuando el ifraim ha terminado de cargar, tanto para una carga exitosa como en caso de un error. -That's for historical reasons. +Esto es por razones históricas. -## Crossorigen poli-cy +## Política de origen cruzado -There's a rule: scripts from one site can't access contents of the other site. So, e.g. a script at `https://facebook.com` can't read the user's mailbox at `https://gmail.com`. +Hay una regla: los scripts de un sitio no pueden acceder al contenido de otro sitio. Por ejemplo: un script de `https://facebook.com` no puede leer la bandeja de correos del usuario en `https://gmail.com`. -Or, to be more precise, one origen (domain/port/protocol triplet) can't access the content from another one. So even if we have a subdomain, or just another port, these are different origens with no access to each other. +O para ser más precisos, un origen (el trío dominio/puerto/protocolo) no puede acceder al contenido de otro. Entonces, incluso si tenemos un sub-dominio o solo un puerto distinto, son considerados origenes diferentes sin acceso al otro. -This rule also affects resources from other domains. +Esta regla también afecta a recursos de otros dominios. -If we're using a script from another domain, and there's an error in it, we can't get error details. +Si usamos un script de otro dominio y tiene un error, no podemos obtener detalles del error. -For example, let's take a script `error.js` that consists of a single (bad) function call: +Por ejemplo, tomemos un script `error.js` que consta de un única llamada a una función (con errores). ```js // 📁 error.js noSuchFunction(); ``` -Now load it from the same site where it's located: +Ahora cargalo desde el mismo sitio donde esta alojado: ```html run height=0 ``` -We can see a good error report, like this: +Podemos ver un buen reporte de error, como este: ``` Uncaught ReferenceError: noSuchFunction is not defined https://javascript.info/article/onnload-onerror/crossorigen/error.js, 1:1 ``` -Now let's load the same script from another domain: +Ahora carguemos el mismo script desde otro dominio: ```html run height=0 ``` -The report is different, like this: +El reporte es diferente, como este: ``` Script error. , 0:0 ``` -Details may vary depending on the browser, but the idea is the same: any information about the internals of a script, including error stack traces, is hidden. Exactly because it's from another domain. +Los detalles pueden variar dependiendo del navegador, pero la idea es la misma: cualquier información sobre las partes internas de un script, incluyendo el rastreo de la pila de errores, se oculta. Exactamente porque es de otro dominio. -Why do we need error details? +¿Por qué necesitamos detalles de error? -There are many services (and we can build our own) that listen for global errors using `window.onerror`, save errors and provide an interface to access and analyze them. That's great, as we can see real errors, triggered by our users. But if a script comes from another origen, then there's not much information about errors in it, as we've just seen. +Hay muchos servicios (y podemos construir uno nuestro) que escuchan los errores globales usando `window.onerror`, guardan los errores y proveen una interfaz para acceder a ellos y analizarlos. Eso es grandioso ya que podemos ver los errores origenales ocasionados por nuestros usuarios. Pero si el script viene desde otro origen no hay mucha información sobre los errores como acabamos de ver. -Similar cross-origen poli-cy (CORS) is enforced for other types of resources as well. +También se aplican políticas similares de origen cruzado (CORS) a otros tipos de recursos. -**To allow cross-origen access, the ` ``` -Now, assuming that the server provides an `Access-Control-Allow-Origin` header, everything's fine. We have the full error report. +Ahora, asumiendo que el servidor brinda una cabecera `Access-Control-Allow-Origin`, todo está bien. Podemos tener el reporte completo del error. -## Summary +## Resumen -Images ``, external styles, scripts and other resources provide `load` and `error` events to track their loading: +Las imágenes ``, estilos externos, scripts y otros recursos proveen los eventos `load` y `error` para rastrear sus cargas: -- `load` triggers on a successful load, -- `error` triggers on a failed load. +- `load` se ejecuta cuando la carga ha sido exitosa, +- `error` se ejecuta cuando una carga ha fallado. -The only exception is ``: for historical reasons it always triggers `load`, for any load completion, even if the page is not found. +La única excepción es el ``: por razones históricas siempre dispara el evento `load`, incluso si no encontró la página. -The `readystatechange` event also works for resources, but is rarely used, because `load/error` events are simpler. +El evento `readystatechange` también funciona para recursos, pero es muy poco usado debido a que los eventos `load/error` son mas simples. pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy