'window.open' blocked by Chrome with change event

Adam Hollock

I am trying to open a window based on an onChange event on a select element without getting blocked by Chrome's popup blocker.

The problem is demonstrated here.

https://jsfiddle.net/yyfe0824/1/

<select class="dropdown-select" onChange="window.open('https://www.google.com');">
    <option value="uno">Uno</option>
    <option value="dos">Dos</option>
    <option value="tres">Tres</option>
</select>

<input type="button" onClick="window.open('https://www.google.com');" value="click me">

There is no problem with a window.open call on the 'click me' button, but if you try to change the select dropdown, chrome will block the popup.

So far, answers to this problem have been specific to the onClick event. Doing research reveals that Chrome will block popups if it detects that it is not user triggered via some sort of handler, so I'm specifically trying to call the function inline, rather than using another named function.

Is this the intended behavior of window.open, specifically for onChange and if so, is there any particular workaround? (Aside from changing the structure to be a click event in the first place.)

Juan Mendes

That is by design, the only time browsers don't block window.open is when you are handling a click event.

My suggestion is to provide a link that changes when users select from the dropdown.

I advise against opening a popup because users don't expect a popup when you select from a drop down, that is why popup blockers don't typically allow this. Even if you find something that works in a browser (https://jsfiddle.net/yyfe0824/5/ in Firefox), it could break in the future.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to open the Chrome Developer Tools in a new window?

From Dev

Angularjs $window.open popups being blocked

From Dev

window.open() is blocked by browser when is called from promise

From Dev

window.open as tabs not pop ups in Chrome

From Dev

Chrome synchronizes tabs after window.open()

From Dev

jquery window.open in ajax success being blocked

From Dev

window.open blocked if performed in ajax completed

From Dev

AngularJS event on window innerWidth size change

From Dev

Allow user to change URL in window.open()

From Dev

Javascript window.print() in chrome, closing new window or tab instead of cancelling print leaves javascript blocked in parent window

From Dev

Open Chrome Developer Tools in Its Own Window

From Dev

Functionality of window.open() in google chrome

From Dev

Open a link in an Incognito Window in Google Chrome

From Dev

Javascript to open a new window and change header text

From Dev

chrome is opening window.open() in full window mode.

From Dev

how to open closed window in chrome

From Dev

Chrome extension open new window behind the current window

From Dev

window.open() is blocked by browser when is called from promise

From Dev

window.open works in Firefox but not IE or Chrome

From Dev

Force Chrome to open new tabs in specific window

From Dev

Open a new Chrome window with custom URL, then get that same window with Autohotkey?

From Dev

Cannot Open Extensions Window in Chrome

From Dev

Detect change in window height and width with event listener

From Dev

Javascript to open a new window and change header text

From Dev

Chrome Window.open strugles

From Dev

How to Open the Profile Management Window Every Time You Open Chrome?

From Dev

how to change element with jquery window resize event

From Dev

Where are Google Chrome 'open as window' shortcuts stored?

From Dev

PySide2 QAction Event Blocked until window closed

Related Related

  1. 1

    How to open the Chrome Developer Tools in a new window?

  2. 2

    Angularjs $window.open popups being blocked

  3. 3

    window.open() is blocked by browser when is called from promise

  4. 4

    window.open as tabs not pop ups in Chrome

  5. 5

    Chrome synchronizes tabs after window.open()

  6. 6

    jquery window.open in ajax success being blocked

  7. 7

    window.open blocked if performed in ajax completed

  8. 8

    AngularJS event on window innerWidth size change

  9. 9

    Allow user to change URL in window.open()

  10. 10

    Javascript window.print() in chrome, closing new window or tab instead of cancelling print leaves javascript blocked in parent window

  11. 11

    Open Chrome Developer Tools in Its Own Window

  12. 12

    Functionality of window.open() in google chrome

  13. 13

    Open a link in an Incognito Window in Google Chrome

  14. 14

    Javascript to open a new window and change header text

  15. 15

    chrome is opening window.open() in full window mode.

  16. 16

    how to open closed window in chrome

  17. 17

    Chrome extension open new window behind the current window

  18. 18

    window.open() is blocked by browser when is called from promise

  19. 19

    window.open works in Firefox but not IE or Chrome

  20. 20

    Force Chrome to open new tabs in specific window

  21. 21

    Open a new Chrome window with custom URL, then get that same window with Autohotkey?

  22. 22

    Cannot Open Extensions Window in Chrome

  23. 23

    Detect change in window height and width with event listener

  24. 24

    Javascript to open a new window and change header text

  25. 25

    Chrome Window.open strugles

  26. 26

    How to Open the Profile Management Window Every Time You Open Chrome?

  27. 27

    how to change element with jquery window resize event

  28. 28

    Where are Google Chrome 'open as window' shortcuts stored?

  29. 29

    PySide2 QAction Event Blocked until window closed

HotTag

Archive