0

I want script to open in new tab url without focusing on it. I tried:

window.open("https://www.google.com/").blur();
window.focus();

But it opens a new tab and focuses on google.com not on site with script. What's wrong?

edit:

This Open a new tab in the background? is not resolving my question. Answer is too old and doesn't work anymore! Admins please read bold text: UPDATE: By version 41 of Google Chrome, initMouseEvent seemed to have a changed behavior, and so this answer no longer works.

Stack1233
  • 85
  • 5
  • 1
    Does this answer your question? [JS open url in new tab on background](https://stackoverflow.com/questions/72748311/js-open-url-in-new-tab-on-background) – Christopher Jun 24 '22 at 22:56
  • @Christopher of course not. It's mine question but it was blocked with reason `This question already has answers here:` as I wrote that answer is too old and it's not working anymore. I edited answer but I cannot wait admins to recheck questions. – Stack1233 Jun 24 '22 at 23:01
  • 1
    If you think your question was closed inappropriately you should explain why and request that it be reopened. – Barmar Jun 24 '22 at 23:06
  • There are also other [unanswered questions](https://stackoverflow.com/questions/46819883/js-open-tab-in-background-simulate-ctrl-click) related to this topic. Some sites abused this to load other sites in the background with stuff like "Hey you are the 1.000.000th Visitor! Congrats on your new bagpipe!". And there might also be some other reasons why this behavior was changed. - If you think it is a bug, you can create a new issue at https://bugs.chromium.org/p/chromium/issues/list for Chromium based Browsers or https://bugzilla.mozilla.org/ for Firefox. – Christopher Jun 24 '22 at 23:11
  • @dippas no. I've mentioned it in my question. – Stack1233 Jun 24 '22 at 23:21
  • The so called popunder-methods are security related issues and if a new one gets discovered, it won't be available for long. – Some related issues: https://crbug.com/229402, https://crbug.com/304547, https://crbug.com/521343, https://crbug.com/752824, https://crbug.com/833148, https://crbug.com/836841, https://crbug.com/1058737 – Christopher Jun 25 '22 at 11:01

0 Answers0