Sunday, February 8, 2015

How to open link in new tab on html?

Set the 'target' attribute of the link to _blank:

<a href="#" target="_blank">Link</a>
 
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).

No comments:

Post a Comment