From 41565d2bb720fa2360cc4c27d877c8296a956364 Mon Sep 17 00:00:00 2001 From: Homero304 Date: Mon, 31 Aug 2020 22:21:26 -0500 Subject: [PATCH 01/11] Cross-window communication --- .../03-cross-window-communication/article.md | 260 +++++++++--------- .../postmessage.view/iframe.html | 4 +- .../postmessage.view/index.html | 4 +- .../sandbox.view/index.html | 2 +- .../sandbox.view/sandboxed.html | 4 +- 5 files changed, 137 insertions(+), 137 deletions(-) diff --git a/3-frames-and-windows/03-cross-window-communication/article.md b/3-frames-and-windows/03-cross-window-communication/article.md index 53f5f55fc..f9d9ce9f6 100644 --- a/3-frames-and-windows/03-cross-window-communication/article.md +++ b/3-frames-and-windows/03-cross-window-communication/article.md @@ -1,88 +1,88 @@ -# Cross-window communication +# Comunicación entre ventanas -The "Same Origin" (same site) policy limits access of windows and frames to each other. +La política de "Mismo origen" (mismo sitio) limita el acceso de ventanas y marcos entre sí. -The idea is that if a user has two pages open: one from `john-smith.com`, and another one is `gmail.com`, then they wouldn't want a script from `john-smith.com` to read our mail from `gmail.com`. So, the purpose of the "Same Origin" policy is to protect users from information theft. +La idea es que si un usuario tiene dos páginas abiertas: una de `john-smith.com`, y otra es` gmail.com`, entonces no querrán que un script de `john-smith.com` lea nuestro correo de `gmail.com`. Por lo tanto, el propósito de la política de "Mismo origen" es proteger a los usuarios del robo de información. -## Same Origin [#same-origin] +## Mismo origen [#same-origin] -Two URLs are said to have the "same origin" if they have the same protocol, domain and port. +Se dice que dos URL tienen el "mismo origen" si tienen el mismo protocolo, dominio y puerto. -These URLs all share the same origin: +Todas estas URL comparten el mismo origen: - `http://site.com` - `http://site.com/` - `http://site.com/my/page.html` -These ones do not: +Estas no: -- http://www.site.com (another domain: `www.` matters) -- http://site.org (another domain: `.org` matters) -- https://site.com (another protocol: `https`) -- http://site.com:8080 (another port: `8080`) +- http://www.site.com (otro dominio: `www.` importa) +- http://site.org (otro dominio: `.org` importa) +- https://site.com (otro protocolo: `https`) +- http://site.com:8080 (otro puerto: `8080`) -The "Same Origin" policy states that: +La política de "Mismo origen" establece que: -- if we have a reference to another window, e.g. a popup created by `window.open` or a window inside ` ``` -The code above shows errors for any operations except: +El código anterior muestra errores para cualquier operación excepto: -- Getting the reference to the inner window `iframe.contentWindow` - that's allowed. -- Writing to `location`. +- Obtener la referencia a la ventana interna `iframe.contentWindow` - eso está permitido. +- Escribir a `location`. -Contrary to that, if the ` @@ -156,26 +156,26 @@ We can try to catch the moment earlier using checks in `setInterval`: ``` -## Collection: window.frames +## Colección: window.frames -An alternative way to get a window object for ` @@ -186,93 +186,93 @@ For instance: ``` -An iframe may have other iframes inside. The corresponding `window` objects form a hierarchy. +Un iframe puede tener otros iframes en su interior. Los objetos `window` correspondientes forman una jerarquía. -Navigation links are: +Los enlaces de navegación son: -- `window.frames` -- the collection of "children" windows (for nested frames). -- `window.parent` -- the reference to the "parent" (outer) window. -- `window.top` -- the reference to the topmost parent window. +- `window.frames` -- la colección de ventanas "hijas" (para marcos anidados). +- `window.parent` -- la referencia a la ventana "padre" (exterior). +- `window.top` -- la referencia a la ventana padre superior. -For instance: +Por ejemplo: ```js run window.frames[0].parent === window; // true ``` -We can use the `top` property to check if the current document is open inside a frame or not: +Podemos usar la propiedad `top` para verificar si el documento actual está abierto dentro de un marco o no: ```js run if (window == top) { // current window == window.top? - alert('The script is in the topmost window, not in a frame'); + alert('El script está en la ventana superior, no en un marco.'); } else { - alert('The script runs in a frame!'); + alert('¡El script se ejecuta en un marco!'); } ``` -## The "sandbox" iframe attribute +## "sandbox", el atributo de iframe -The `sandbox` attribute allows for the exclusion of certain actions inside an ` diff --git a/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html b/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html index 46dd7b5cc..e87a6fed0 100644 --- a/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html +++ b/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html @@ -7,7 +7,7 @@ -
The iframe below has the sandbox attribute.
+
El siguiente iframe tiene el atributo sandbox .
diff --git a/3-frames-and-windows/03-cross-window-communication/sandbox.view/sandboxed.html b/3-frames-and-windows/03-cross-window-communication/sandbox.view/sandboxed.html index c10273255..8db29b86b 100644 --- a/3-frames-and-windows/03-cross-window-communication/sandbox.view/sandboxed.html +++ b/3-frames-and-windows/03-cross-window-communication/sandbox.view/sandboxed.html @@ -7,11 +7,11 @@ - +
- +
From f15ce6d55564bea4661051bdd96e0433804c038a Mon Sep 17 00:00:00 2001 From: Homero Enrique Marin Galindo Date: Tue, 1 Sep 2020 01:44:24 -0500 Subject: [PATCH 02/11] Update 3-frames-and-windows/03-cross-window-communication/article.md Co-authored-by: joaquinelio --- 3-frames-and-windows/03-cross-window-communication/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3-frames-and-windows/03-cross-window-communication/article.md b/3-frames-and-windows/03-cross-window-communication/article.md index f9d9ce9f6..266907350 100644 --- a/3-frames-and-windows/03-cross-window-communication/article.md +++ b/3-frames-and-windows/03-cross-window-communication/article.md @@ -2,7 +2,7 @@ La política de "Mismo origen" (mismo sitio) limita el acceso de ventanas y marcos entre sí. -La idea es que si un usuario tiene dos páginas abiertas: una de `john-smith.com`, y otra es` gmail.com`, entonces no querrán que un script de `john-smith.com` lea nuestro correo de `gmail.com`. Por lo tanto, el propósito de la política de "Mismo origen" es proteger a los usuarios del robo de información. +La idea es que si un usuario tiene dos páginas abiertas: una de `john-smith.com`, y otra es `gmail.com`, entonces no querrán que un script de `john-smith.com` lea nuestro correo de `gmail.com`. Por lo tanto, el propósito de la política de "Mismo origen" es proteger a los usuarios del robo de información. ## Mismo origen [#same-origin] From ff63369a2e65275953ce2d854df9e1125fcac23a Mon Sep 17 00:00:00 2001 From: Homero Enrique Marin Galindo Date: Tue, 1 Sep 2020 01:44:56 -0500 Subject: [PATCH 03/11] Update 3-frames-and-windows/03-cross-window-communication/article.md Co-authored-by: joaquinelio --- 3-frames-and-windows/03-cross-window-communication/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3-frames-and-windows/03-cross-window-communication/article.md b/3-frames-and-windows/03-cross-window-communication/article.md index 266907350..fd52cf5d0 100644 --- a/3-frames-and-windows/03-cross-window-communication/article.md +++ b/3-frames-and-windows/03-cross-window-communication/article.md @@ -82,7 +82,7 @@ El código anterior muestra errores para cualquier operación excepto: - Obtener la referencia a la ventana interna `iframe.contentWindow` - eso está permitido. - Escribir a `location`. -Al contrario, si el `