How can I open a link in new tab (and not new window)?
html, javascript
Solution
Update [2019] Most browsers today open in a new tab when you set the target to `_blank`. The days of popup windows is long gone. We can now use:
<a href="some url" target="_blank">content of the anchor</a>
Most sane browsers will open the new window in a new tab.
CSS3 supports "open in new tab", by the property target-new
target-new: window | tab | none;
Update [2016]: this method never made it into the CSS3 spec, as one of the comments indicates. This shouldn't be used. However, it can be seen that most modern browsers open `target='_blank'` links in a new tab anyway, unless one attempts to resize the new tab immediately thereafter. However, there does not appear to be a mechanism to force this behavior in the specifications.
[2011] For a method of forcing opening in a new tab that is well supported, try the following:
<a href="some url" target="_newtab">content of the anchor</a>
Else, use this method to resize window immediately, to ensure that popup blockers do not kill your popup
Problem
I have an 'Open' button that 'calculates' a link that should be opened in a new tab. I try to use: ``` window.open(url, '_blank'); ``` But that opens a new window. I also tried the following method: ``` <form id="oform" name="oform" action="" method="post" target="_blank"> </form> ... document.getElementById("oform").action = url; document.getElementById("oform").submit(); ``` Still, a new window is opened, instead of a new tab. When using simple `<a href...>` with `target='blank'`, the link is opened in a new tab. Is there a solution?