It turns out window.outerWidth and window.outerHeight have been around a while but did not show up in IE until IE9.
The following code example opens a window with maximum size but clear of task bars by first opening it with minimum size and then resizing the opened window to occupy all of the available area.
function splashOpen(url)
{
var winFeatures = 'screenX=0,screenY=0,top=0,left=0,scrollbars,width=100,height=100';
var winName = 'window';
var win = window.open(url,winName, winFeatures);
var extraWidth = win.screen.availWidth - win.outerWidth;
var extraHeight = win.screen.availHeight - win.outerHeight;
win.resizeBy(extraWidth, extraHeight);
return win;
}
// and test
splashOpen("javascript:'hello folks and world'");
Noting:
the MDN wiki example of a window features string appears to be incorrect: include the names of features required and omit those not required.
Users may have selectively disabled suppression of widow.open features. (In Mozilla Firefox see
about:configunderdom.disable_window_open_featureto prevent popups hiding location details or disabling other useful features.)
window.open() popup=1 does not open popup in Google Chrome - Stack Overflow
window.open creates Pop-up warning in Chrome BUT still opens window
Open new popup chrome window without tab section
Can I force chrome to open "pop out" windows in a new tab instead of a teeny window?
Videos
There is a 3 step workaround you can do this by
- You should know when the popup will be opened. Popups are blocked in chrome by default. But chrome will show a popup blocked notification in bottom right corner.
- click on notification to select always accept popup from this specific site
- Reload the main (parent) page. This will load the popup in small windows. Right click in titlebar of popup window and select "Show As Tab". Once popup is transformed in a window with tab, you can drag it back to main window.
Hope this helps.
Thanks.
There is the chrome extension One Window.
It is not perfect, as the popup will first be opened and then "transformed" into a tab, which you will see as a flicker. Otherwise it seems to work fine.
Turn pop-ups on or off
- On your computer, open Chrome.
- At the top right, click More. Settings.
- At the bottom, click Advanced.
- Under 'Privacy and security', click Site settings.
- Click Pop-ups and redirects.
- At the top, turn the setting to Allowed or Blocked.
I am very late to this question but if you're using Mac and your browser is in full screen mode, it always opens pop ups in a new tab. This might help some people trying to debug this issue.
Please see tutorial here: http://www.w3schools.com/jsref/met_win_open.asp
<script>
function myFunction() {
window.open("http://www.w3schools.com","_blank",
"toolbar,scrollbars,resizable,top=500,left=500,width=400,height=400");
}
</script>
<!DOCTYPE html>
<html>
<body>
<button onclick="openTheWindow()">open window</button>
<script>
function openTheWindow() {
var myWindow = window.open("", "", "width=800,height=800");
}
</script>
</body>
</html>
It's verry irritating when sites do this, especially because I use a script blocker that means sites have to be approved, The toolbar does not appear in these breakout windows.
You can't. Window.focus is disabled in Chrome for security reasons, and that is unlikely to change.
You have to close and repopen the respective window.
Why not just do a popopWindow.focus() after the window.open call? It won't hurt to do it there too, and it should ensure that your new window is shown on top of the current one.