From 181832ee6d0887410d6ca2f1c1db9c6438f1a403 Mon Sep 17 00:00:00 2001 From: Shahrzad Javadi Koushesh Date: Fri, 1 Sep 2023 12:49:08 +0330 Subject: [PATCH 01/12] line 41 --- .../03-cross-window-communication/article.md | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 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 aa9d1cab4..860484403 100644 --- a/3-frames-and-windows/03-cross-window-communication/article.md +++ b/3-frames-and-windows/03-cross-window-communication/article.md @@ -1,43 +1,44 @@ -# Cross-window communication +# ارتباط بین پنجره‌ای -The "Same Origin" (same site) policy limits access of windows and frames to each other. +سیاست "Same Origin" (همان سایت) دسترسی پنجره‌ها و فریم‌ها به یکدیگر را محدود می‌کند. -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. +ایده این است که اگر یک یک کاربر دو صفحه‌ی باز داشته باشد: یکی از `john-smith.com` و دیگری از `gmail.com`، آنگاه آن‌ها نمی‌خواهند که که یک script از `john-smith.com` تمام نامه‌‌های شما از `gmail.com` را بخواند. بنابراین، هدف سیاست "Same Origin" این است که کاربران را از دزدی اطلاعات حفظ کند. ## Same Origin [#same-origin] -Two URLs are said to have the "same origin" if they have the same protocol, domain and port. +اگر URLها یک protocol، domain و ports داشته باشند، می‌گویند که "same origin" دارند. -These URLs all share the same origin: +این URLها همگی یک منبع را به اشتراک می‌گذارند. - `http://site.com` - `http://site.com/` - `http://site.com/my/page.html` -These ones do not: +این یکی‌ها نه: - 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`) -The "Same Origin" policy states that: +سیاست "Same Origin" بیان می‌کند که: -- if we have a reference to another window, e.g. a popup created by `window.open` or a window inside ` From 54a8d6a7777ee5be2c806babf17a9927c758c341 Mon Sep 17 00:00:00 2001 From: Shahrzad Javadi Koushesh Date: Fri, 1 Sep 2023 14:16:02 +0330 Subject: [PATCH 02/12] line 105 --- .../03-cross-window-communication/article.md | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 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 860484403..3da88c514 100644 --- a/3-frames-and-windows/03-cross-window-communication/article.md +++ b/3-frames-and-windows/03-cross-window-communication/article.md @@ -45,22 +45,22 @@ For instance, let's try reading and writing to ` @@ -65,7 +64,7 @@ For instance, let's try reading and writing to ` @@ -163,14 +163,14 @@ We can try to catch the moment earlier using checks in `setInterval`: ``` From 84f419a664140115b6fd9b9671f0bc26a98049f3 Mon Sep 17 00:00:00 2001 From: Shahrzad Javadi Koushesh Date: Sun, 3 Sep 2023 09:37:42 +0330 Subject: [PATCH 05/12] line 181 --- .../03-cross-window-communication/article.md | 6 +++--- 1 file changed, 3 insertions(+), 3 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 79897f8d6..f8285b23e 100644 --- a/3-frames-and-windows/03-cross-window-communication/article.md +++ b/3-frames-and-windows/03-cross-window-communication/article.md @@ -175,11 +175,11 @@ document.domain = 'site.com'; ``` -## Collection: window.frames +## مجموعه: window.frames -An alternative way to get a window object for ` @@ -193,27 +193,27 @@ For instance: ``` -An iframe may have other iframes inside. The corresponding `window` objects form a hierarchy. +یک فریم ممکن است فریم‌های دیگری هم درون خود داشته باشد. اشیای `پنجره‌ی` مربوطه یک سلسله مراتب را تشکیل می‌دهند. -Navigation links are: +لینک‌های هدایت‌کننده این‌ها هستند: -- `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` -- مجموعه‌ی پنجره‌های "فرزند" (برای فریم‌های تو در تو). +- `window.parent` -- ارجاع به پنجره‌ی "والد" (بیرونی). +- `window.top` -- ارجاع به بالاترین پنجره‌ی والد. -For instance: +برای مثال: ```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: +می‌توانیم از `top` property استفاده کنیم که چک کنیم که document جاری درون یک فریم باز است یا نه: ```js run -if (window == top) { // current window == window.top? - alert('The script is in the topmost window, not in a frame'); +if (window == top) { // جاری window == window.top? + alert('در بالاترین پنجره است، نه در یک فریم script'); } else { - alert('The script runs in a frame!'); + alert('!در یک فریم اجرا می‌شود script'); } ``` From 27f492588a23cebfd8329ef464574047cc775172 Mon Sep 17 00:00:00 2001 From: Shahrzad Javadi Koushesh Date: Sun, 3 Sep 2023 17:54:59 +0330 Subject: [PATCH 07/12] line 222 --- 3-frames-and-windows/03-cross-window-communication/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 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 9809fb3c6..0171f70ab 100644 --- a/3-frames-and-windows/03-cross-window-communication/article.md +++ b/3-frames-and-windows/03-cross-window-communication/article.md @@ -217,9 +217,9 @@ if (window == top) { // جاری window == window.top? } ``` -## The "sandbox" iframe attribute +## "sandbox" iframe attribute -The `sandbox` attribute allows for the exclusion of certain actions inside an `