0

I have this line of JavaScript code:

window.open('queue.html', 'QueueMonitor', 'toolbar=no,scrollbars=yes,resizable=yes,top=0,left=' + screen.availWidth);

The expected output is to open a popup on the second display monitor - this works fine in Firefox and IE11 but not in Chrome, Opera and Edge. I've already tried looking for similar problems, but I can't find a solution.

Do you have any idea why? or how to go about this?

EDIT 1

I'm sorry, I didn't put there that but not in.... means, the popup is displayed in the main display monitor and not in the second.

EDIT 2

Tried adding width=100,height=100, but it only gives me this (on the said 3 browsers): Popup screenshot You can see it's like in between the 2 screens - not really in half but there's some window boundary left on the main display (left).

dunli
  • 1,356
  • 9
  • 18
  • I think these browsers don't support some specs of `window.open()`. – Vadim Dec 18 '18 at 09:21
  • It might get blocked in that browsers. Popup blockers usually works blocking every popup, which is not triggered by a direct user action, like clicking on a button or a link. – zwif Dec 18 '18 at 09:41

2 Answers2

0

Specify a width and height like this:

window.open('http://www.google.com/', 'name', 'width=400,height=320,toolbar=no,scrollbars=yes,resizable=yes,top=0,left=' + screen.availWidth);

I tested this in the developer console in Google Chrome (Version 60.0.3112.113).


Edit

As this question is specifically related to displaying the new window on the second display the above answer won't suffice. As mentioned in my comment I recommend checking out this question as it might help you.

Arjan
  • 599
  • 5
  • 23
  • Already tried putting width and height, it doesn't go to the second display. I'm using version 71.0.3578.98 – dunli Dec 18 '18 at 13:49
  • Wait. Is the issue it not being displayed on the second monitor or there being no popout at all? – Arjan Dec 18 '18 at 13:50
  • Sorry, the issue is it not being displayed on the second monitor. Had to put an edit to my question. – dunli Dec 18 '18 at 13:55
  • I suggest reading up on this post, it probably covers what you need. https://stackoverflow.com/questions/16363474/window-open-on-a-multi-monitor-dual-monitor-system-where-does-window-pop-up – Arjan Dec 18 '18 at 14:01
0

Could you check below for specs parameter of window.open and let us know whether this helps you:

  • resizable: IE only
  • scrollbars: IE, Firefox & Opera only
  • toolbar: IE and Firefox only
Happs
  • 115
  • 7
  • Do these parameters have to do with `left` not working on other browsers? – dunli Dec 18 '18 at 14:15
  • @dunli Could you check the value of screen.availWidth when opening in Chrome. It should not be negative. – Happs Dec 26 '18 at 00:44