javascript – Open multiple tabs with one click Chrome

Question:

The question is – is it possible to do this with any hacks?
I have users select a list of links and on click they should open at once in new tabs.

I've been searching for a few days now. Tried creating links by js, window.open(), fake clicks, attributes, 2 libs and nothing…

And of course, this means bypassing pop-up blockers.

Thank you.

Answer:

window.open() requires the following conditions:

  1. The stack trace must contain the trusted event. Formally, a click is not necessarily needed to trigger such an event, the same mousemove gives a trusted event no worse than click .
document.querySelector('button').onclick = event=>console.log(event.isTrusted);
document.querySelector('button').onmousemove = event=>console.log(event.isTrusted);
<button>Click me</button>
  1. There is one of two things: either the browser has a voluntarily manually set permission for pop-up windows by the user. Either allow-popups or unsave-none will be passed among the Cross-Origin-Opener-Policy headers. Examples can be taken from here . If the server belongs to you, then this should not be a problem.
Scroll to Top