Skip to content

Commit f0e5c94

Browse files
line 238
1 parent c28834e commit f0e5c94

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

3-frames-and-windows/01-popup-windows/article.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,25 +217,25 @@ newWindow.onload = function() {
217217

218218
## Focus/blur روی یک پنجره
219219

220-
Theoretically, there are `window.focus()` and `window.blur()` methods to focus/unfocus on a window. And there are also `focus/blur` events that allow to catch the moment when the visitor focuses on a window and switches elsewhere.
220+
از نظر تئوری برای focus/unfocus کردن روی یک پنجره، دو متد `window.focus()` و `window.blur()` وجود دارند. و همچنین `focus/blur` events هستند که که اجازه می‌دهند که لحظه‌ای که بازدیدکننده روی یک پنجره focus/unfocus می‌کند و به جای دیگری تغییر می‌دهد را ثبت کنید.
221221

222-
Although, in practice they are severely limited, because in the past evil pages abused them.
222+
اگرچه، در عمل آنها به شدت محدود هستند، زیرا در گذشته صفحات بد از آنها سوء استفاده می‌کردند.
223223

224-
For instance, look at this code:
224+
برای مثال به این کد نگاه کنید:
225225

226226
```js run
227227
window.onblur = () => window.focus();
228228
```
229229

230-
When a user attempts to switch out of the window (`window.onblur`), it brings the window back into focus. The intention is to "lock" the user within the `window`.
230+
وقتی یک کاربر تلاش می‌کند که از پنجره بیرون برود (`window.onblur`)، این، پنجره را به focus برمی‌گرداند. هدف این است که کاربر را در `window` قفل کنیم.
231231

232-
So browsers had to introduce many limitations to forbid the code like that and protect the user from ads and evils pages. They depend on the browser.
232+
در نتیجه مرورگرها مجبور بودند تعدادی محدودیت معرفی کنند تا کدی مثل آن را ممنوع کند و کاربر را از تبلیغات و صفحات بد محافظت کنند. آن‌ها به مرورگر بستگی دارند.
233233

234-
For instance, a mobile browser usually ignores `window.focus()` completely. Also focusing doesn't work when a popup opens in a separate tab rather than a new window.
234+
برای مثال، یک مرورگر موبایل معمولا `window.focus()` را به طور کامل نادیده می‌گیرد. همچنین وقتی که یک popup در یک صفحه‌ی جدا به جای یک پنجره‌ی جدبد باز می‌شود، فوکوس کردن کار نمی‌کند.
235235

236-
Still, there are some use cases when such calls do work and can be useful.
236+
با این حال، موارد استفاده‌ای وجود دارد که چنین فراخوانی‌هایی کار می‌کنند و می‌توانند مفید باشند.
237237

238-
For instance:
238+
برای مثال:
239239

240240
- When we open a popup, it might be a good idea to run `newWindow.focus()` on it. Just in case, for some OS/browser combinations it ensures that the user is in the new window now.
241241
- If we want to track when a visitor actually uses our web-app, we can track `window.onfocus/onblur`. That allows us to suspend/resume in-page activities, animations etc. But please note that the `blur` event means that the visitor switched out from the window, but they still may observe it. The window is in the background, but still may be visible.

0 commit comments

Comments
 (0)