I'm trying to open a page in a popup as opposed to new tab - but whichever browser I try this simply opens in a new tab, not popup.
<input type="button" value="new win" onclick="window.open('http://yahoo.com', 'width=500, height=400')" />
Any reason why?
Second parameter must be the window name:
<input type="button" value="new win"
onclick="window.open('http://yahoo.com', 'mywindow', 'width=500, height=400')" />
Working fine in Chrome and Firefox:
http://jsfiddle.net/DvMy5/2/
The problem is the 3rd argument to window.open. When you pass the 3rd argument, the browser will open a new window provided the window name(second argument is not already opened).
window.open("http://localhost:5000", "newWindow", "resizable")will open window but window.open("http://localhost:5000", "newWindow") will open a tab.
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