i want to make sure that in all tab enabled browsers, when a user clicks a link, it opens in a new tab. All i have got so far is the target keyword in the anchor, but is there some new html attribute that supports that function?
You can make a HTML link open in a new tab by adding the target=”_blank” attribute. You should insert this after the link address.
Use Mouse or Trackpad Only If you use a mouse, simply utilizing the middle mouse button to click on a link will immediately open it in a new browser tab! Holding down the Shift key while middle-clicking also helps you switch to the tab automatically. Trackpads on Windows laptops can also open links in new tabs.
There is no guaranteed way for that because you can change window opening behavior and tabbing options from within browser options.
The best you can do is to write your code using either target="_blank"
or window.open()
.
There is a CSS3-property target-new
Unfortunately it isn't supported yet by any browser(I don't know any). But maybe you could already implement it for future use.
Your best bet is <a href="..." target="_blank"></a>
.
There is no standardized semantic way of telling the browser to open a new tab. This is because not all browsers have tabs. Take most mobile browsers, for example, they don't have tabs.
There is also no vendor specific way of doing this that I know of.
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