When I'm using firefox and then using window.open('blah.com','blah','left=-30,top=-300');
, the popup opens in my second display above my first one but in chrome, the popup just opens at left=0,top=0
. Is there a reason why chrome is doing this and how would I fix the problem?
Thanks!
You can use "window. moveTo(X,Y)" to set the position of popup window.
In setting of a default popup window size/position for Chrome, first open an instance of a broswer. Then press on the upright "Restore" button of the opened browser(Google Chrome). Go make adjustment to desired size and position of the window for the browser. Maximize the main tabbed window of the browser.
The syntax to open a popup is: window. open(url, name, params) : url. An URL to load into the new window.
This is a bug in Chrome when the pop-up window is opened on the secondary monitor. The Chrome folks seem to say that this is a security issue (though how this is a security issue is beyond me).
Now, opening a pop-up window on a NON-EXISTENT secondary monitor, I could understand is a security issue, but... whatever.
Here's a link to a discussion on the matter:
https://code.google.com/p/chromium/issues/detail?id=137681
I know this is an old post but here's my solution to it. Just use the "avail*" properties of the screen object:
var windowSize = { width: 500, height: 500, }; var windowLocation = { left: (window.screen.availLeft + (window.screen.availWidth / 2)) - (windowSize.width / 2), top: (window.screen.availTop + (window.screen.availHeight / 2)) - (windowSize.height / 2) }; window.open(http://example.com, '_blank', 'width=' + windowSize.width + ', height=' + windowSize.height + ', left=' + windowLocation.left + ', top=' + windowLocation.top);
Basically, the "window.screen.availLeft" gives you the other screens width so you can add you're normal center calculation to that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With