Search code examples
javascriptparametersdefaultwindow.opennew-window

JavaScript: How to open new window with default features?


The window.open function in JS can be used to open a new tab or window. By default, without the third param, it opens a new tab:

window.open("http://...","_blank");

When specifying the third param, it opens a new window:

window.open("http://...","_blank","location=yes,...");

However, I wish to let user open a new window with default window features just like when the user presses Ctrl+N or "New window" from menu. Possible?

Ps. And it seems window.open can open a new browser window, but no tabs. However, I want tabs.


Solution

  • The answer is possibly 'no way' to window.open with tabs in new window.

    However, if the JS code runs in browser extension, use extension API to create windows with tabs:

    chrome.windows.create({url:SOME_URL});