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
The difference is that Firefox treats a timeout of 2000ms or less are acceptable, but after it -- removes the "trust", assuming that now it's "outside of the user action". So the first one is blocked, and the second one is not.
60
-
61
41
## window.open
62
42
63
43
The syntax to open a popup is: `window.open(url, name, params)`:
@@ -87,7 +67,7 @@ Settings for `params`:
87
67
88
68
There is also a number of less supported browser-specific features, which are usually not used. Check <ahref="https://developer.mozilla.org/en/DOM/window.open">window.open in MDN</a> for examples.
89
69
90
-
## Example: a minimalistic window
70
+
## Example: a minimalistic window
91
71
92
72
Let's open a window with minimal set of features, just to see which of them browser allows to disable:
93
73
@@ -120,7 +100,7 @@ Rules for omitted settings:
120
100
121
101
## Accessing popup from window
122
102
123
-
The `open` call returns a reference to the new window. It can be used to manipulate it's properties, change location and even more.
103
+
The `open` call returns a reference to the new window. It can be used to manipulate its properties, change location and even more.
124
104
125
105
In this example, we generate popup content from JavaScript:
126
106
@@ -239,7 +219,7 @@ There's also `window.onscroll` event.
239
219
240
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.
241
221
242
-
Although, in practice they are severely limited, because in the past evil pages abused them.
222
+
Although, in practice they are severely limited, because in the past evil pages abused them.
243
223
244
224
For instance, look at this code:
245
225
@@ -257,10 +237,10 @@ Still, there are some use cases when such calls do work and can be useful.
257
237
258
238
For instance:
259
239
260
-
- When we open a popup, it's might be a good idea to run a`newWindow.focus()` on it. Just in case, for some OS/browser combinations it ensures that the user is in the new window now.
240
+
- 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.
261
241
- 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.
262
242
263
-
## Summary
243
+
## Summary
264
244
265
245
Popup windows are used rarely, as there are alternatives: loading and displaying information in-page, or in iframe.
0 commit comments