JavaScript open in a new window, not tab

I have a select box that calls window.open(url) when an item is selected. Firefox will open the page in a new tab by default. However, I would like the page to open in a new window, not a new tab.

How can I accomplish this?


Solution 1:

Specify window "features" to the open call:

window.open(url, windowName, "height=200,width=200");

When you specify a width/height, it will open it in a new window instead of a tab.

See https://developer.mozilla.org/en-US/docs/Web/API/Window.open#Position_and_size_features for all the possible features.

Solution 2:

You don't need to use height, just make sure you use _blank, Without it, it opens in a new tab.

For a empty window:

window.open('', '_blank', 'toolbar=0,location=0,menubar=0');

For a specific URL:

window.open('http://www.google.com', '_blank', 'toolbar=0,location=0,menubar=0');

Solution 3:

I may be wrong, but from what I understand, this is controlled by the user's browser preferences, and I do not believe that this can be overridden.

Solution 4:

Try:

window.open("", [window name], "height=XXX,width=XXX,modal=yes,alwaysRaised=yes");

I have some code that does what your say, but there is a lot of parameters in it. I think these are the bare minimum, let me know if it doesn't work, I'll post the rest.