Skip to content

Commit 8d185f7

Browse files
authored
Update article.md
1 parent 5dff42b commit 8d185f7

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

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

-20
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,6 @@ button.onclick = () => {
3838

3939
This way users are somewhat protected from unwanted popups, but the functionality is not disabled totally.
4040

41-
What if the popup opens from `onclick`, but after `setTimeout`? That's a bit tricky.
42-
43-
Try this code:
44-
45-
```js run
46-
// open after 3 seconds
47-
setTimeout(() => window.open('http://google.com'), 3000);
48-
```
49-
50-
The popup opens in Chrome, but gets blocked in Firefox.
51-
52-
...If we decrease the delay, the popup works in Firefox too:
53-
54-
```js run
55-
// open after 1 seconds
56-
setTimeout(() => window.open('http://google.com'), 1000);
57-
```
58-
59-
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-
6141
## window.open
6242

6343
The syntax to open a popup is: `window.open(url, name, params)`:

0 commit comments

Comments
 (0)