I have my web browser (Firefox 10 and Chrome 16), so when a new page opens, it opens in the same window on a new tab. When I write a local file as follows:
<html><body><input type="button" onclick="window.open();"/></body></html>
and access this location from a web browser and click the button, a new page will open in the same window on a new tab . It is expected.
However, when I use the local web server (Ruby + Webrick) and dynamically generate the same as above, and access this localhost:3000 location, and click the button, a new page will open in a new window . Why does it behave differently from above and how can I fix the code so that it opens in the same window on a new tab ?
If I do instead
<html><body><input type="button" onclick="window.open("", "_self");"/></body></html>
then a new page opens on the same tab, that is, overwrites the current page .
source share