From 4c103dc69838ac68e044aeed122a529062b98436 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 15 Oct 2018 20:11:58 +0300 Subject: [PATCH] WIP --- .../03-cross-window-communication/article.md | 30 ++++++++++--------- 7-network/1-xmlhttprequest/article.md | 28 +---------------- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/4-frames-and-windows/03-cross-window-communication/article.md b/4-frames-and-windows/03-cross-window-communication/article.md index 1cdac4a3..ffcc1257 100644 --- a/4-frames-and-windows/03-cross-window-communication/article.md +++ b/4-frames-and-windows/03-cross-window-communication/article.md @@ -1,8 +1,8 @@ # Cross-window communication -The "Same Origin" (same site) policy limits access of windows and frame to each other. +The "Same Origin" (same site) policy limits access of windows and frames to each other. -The idea is that if we have two windows open: one from `john-smith.com`, and another one is `gmail.com`, then we wouldn't want a script from `john-smith.com` to read our mail. +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. ## Same Origin [#same-origin] @@ -21,32 +21,31 @@ These ones do not: - https://site.com (another protocol: `https`) - http://site.com:8080 (another port: `8080`) -If we have a reference to another window (a popup or iframe), and that window comes from the same origin, then we can do everything with it. +The "Same Origin" policy states that: -If it comes from another origin, then we can only change its location. Please note: not *read* the location, but *modify* it, redirect it to another place. That's safe, because the URL may contain sensitive parameters, so reading it from another origin is prohibited, but changing is not. +- if we have a reference to another window, e.g. a popup created by `window.open` or a window inside `