<a href="example.com" target="_blank">Text Here</a>
The target
attribute specifies where to open the link. By setting it to _blank
, you tell the browser to open it in a new tab or window (per user preference).
SECURITY VULNERABILITY WARNING!
Using
target="_blank"
gives the opening site partial access to thewindow.opener
object via JavaScript, which allows that page to then access and change thewindow.opener.location
of your page and potentially redirect users to malware or phishing sites.Whenever using this for pages you do not control, add
rel="noopener"
to your link to prevent thewindow.opener
object from being sent with the request.Currently, Firefox does not support
noopener
, so you will need to userel="noopener noreferrer"
for maximum effect.