0

window.open() using JavaScript/Jquery opens a new window but wouldn't let me open a new tab in opened window. How to open window and it should be accessible to open a new tabs.

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open2

function myFunction() {
    var myWindow = window.open("", "", "width=200,height=100");
}
<p>Click the button to open an about:blank page in a new browser window that is 200px wide and 100px tall.</p>

<button onclick="myFunction()">Try it</button>
Taplar
  • 24,788
  • 4
  • 22
  • 35
  • That's entirely dependent upon the browser settings. If you use window.open with a specified width and height you can potentially force it to open a window instead of a tab, but forcing it to be a tab and not a window, afaik, that's entirely in the browsers control. – Taplar Dec 08 '17 at 16:49
  • Possible duplicate of [Open a URL in a new tab (and not a new window) using JavaScript](https://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window-using-javascript) – hashtagerrors Dec 08 '17 at 16:51
  • Speaking of which, that w3school example is using `"width=200,height=100"`. Take that off. – Taplar Dec 08 '17 at 16:52

0 Answers0