You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.را ببینید <info:cross-window-communication> این برای دلایل امنیتی غیرممکن است. برای جزئیات، بخش `gmail.com` از popup باشد و `site.com` در غیر این صورت، برای مثال اگر پنجرهی اصلی از
135
135
```
136
136
137
-
## Accessing window from popup
137
+
## دسترسی به پنجره از طریق popup
138
138
139
-
A popup may access the "opener" window as well using `window.opener`reference. It is `null` for all windows except popups.
139
+
یک popup علاوه بر استفاده از ارجاع `window.opener`میتواند به "opener" هم دسترسی داشته باشد. این برای تمام پنجرهها به جز popupها null است.
140
140
141
-
If you run the code below, it replaces the opener (current) window content with "Test":
141
+
اگر کد زیر را اجرا کنید، محتوای openr window (در حال حاضر) را با "Test" جایگزین میکند.
142
142
143
143
```js run
144
144
let newWin =window.open("about:blank", "hello", "width=200,height=200");
@@ -148,19 +148,19 @@ newWin.document.write(
148
148
);
149
149
```
150
150
151
-
So the connection between the windows is bidirectional: the main window and the popup have a reference to each other.
151
+
بنابراین، ارتباط میان پنجرهها دوطرفه است: پنجرهی اصلی و popup ارجاعی به یکدیگر دارند.
152
152
153
-
## Closing a popup
153
+
## بستن یک popup
154
154
155
-
To close a window: `win.close()`.
155
+
برای بستن یک پنجره: `win.close()`.
156
156
157
-
To check if a window is closed: `win.closed`.
157
+
برای اینکه چک کنیم که یه پنجره بسته است یا نه: `win.closed`.
158
158
159
-
Technically, the `close()` method is available for any `window`, but`window.close()`is ignored by most browsers if `window` is not created with `window.open()`. So it'll only work on a popup.
159
+
از نظر فنی، `close()` method برای هر `window` قابل دسترسی است اما اگر `window` با`window.open()`ایجاد شده باشد، `window.close()` توسط اکثر مرورگرها نادیده گرفته میشود. پس آن فقط روی یک popup کار خواهد کرد.
160
160
161
-
The `closed` property is`true`if the window is closed. That's useful to check if the popup (or the main window) is still open or not. A user can close it anytime, and our code should take that possibility into account.
161
+
اگر پنجره بسته باشد، `closed` property برابر`true`میشود. این برای بررسی اینکه popup (یا پنجرهی اصلی) هنوز باز هستند یا نه مفید است. یک کاربر میتواند هر وقتی ببندد و کد ما باید امکان آن را در نظر بگیرد.
162
162
163
-
This code loads and then closes the window:
163
+
این کد پنجره را load میکند و سپس میبندد.
164
164
165
165
```js run
166
166
let newWindow =open('/', 'example', 'width=300,height=300');
0 commit comments