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?
Default opens in same tab:
Opens in new tab:
If you would like to make the command once for your entire site, instead of having to do it after every link. Try this place within the Head of your web site and bingo.
hope this helps
target="_blank"
attribute will do the job. Just don't forget to addrel="noopener noreferrer"
to solve the potential vulnerability. More on that here: https://dev.to/ben/the-targetblank-vulnerability-by-exampletarget='_blank'
if you are not using XHTML.You can use
<a href='url' target="_blank">name</a>
Example
<a href='https://www.facebook.com/hackbalteamz' target="_blank">Facebook</a>
When to use
target='_blank'
:The HTML version (Some devices not support it):
The JavaScript version for all Devices :
The use of rel="external" is perfectly valid
and for Jquery can try with the below one:
If browser setting don't allow you to open in new windows :