I'm working on an HTML project, and I can't find out how to open a link in a new tab without javascript.
I already know that <a href="http://www.WEBSITE_NAME.com"></a>
opens the link in same tab. Any ideas how to make it open in a new one?
I'm working on an HTML project, and I can't find out how to open a link in a new tab without javascript.
I already know that <a href="http://www.WEBSITE_NAME.com"></a>
opens the link in same tab. Any ideas how to make it open in a new one?
Use one of these as per your requirements.
Open the linked document in a new window or tab:
Open the linked document in the same frame as it was clicked (this is default):
Open the linked document in the parent frame:
Open the linked document in the full body of the window:
Open the linked document in a named frame:
See MDN
Use the "target" attribute of the a tag and assign it to _blank. That is:
target="_blank" always opens a new tab for each click and target="tabName" opens a new tab, but same for each click.
Set the 'target' attribute of the link to
_blank
:Edit: for other examples, see here: http://www.w3schools.com/tags/att_a_target.asp
(Note: I previously suggested
blank
instead of_blank
because, if used, it'll open a new tab and then use the same tab if the link is clicked again. However, this is only because, as GolezTrol pointed out, it refers to the name a of a frame/window, which would be set and used when the link is pressed again to open it in the same tab).You can use
<a href="#" target="_blank">Your Text</a>
Hope it helped. Thanks.Use
target="_blank"
: