0
votes

I'm running a javascript snippet in Google Chrome to open a new window. The command used is just:

win = window.open(Url);

I would like to get Chrome open it in background. I've tried win.blur(), window.focus() and also '_blank', but all with no luck. I know it's possible to do it (the extension Distill Web Monitor does it). Anyone knows how to replicate it? Thanks!

1
Are you writing an extension? Background popups were abused so hard to do this day in age. - epascarello
no, it's code I want to use on local pc. - Shadow King

1 Answers

0
votes

You will likely have very little luck with this as this was a tactic that spammy advertisers used to get their ads to load un-noticed by the user to get them forcefully seen later. As such most browsers block the "raising" and "lowering" of windows.

TL;DR - I don't think you can do this.

In Firefox for example, there is a setting you can set in about:config called dom.disable_window_flip that defaults to true. If you change this to false, you can call win.blur() and it will work.

In your extension scenario... the extension gets additional privileges and this is why it can do it.