A href new window
The classic a href
with a twist!
To open a link in a new window, you can add the target
attribute to the a
tag and set its value to _blank
. Here's the syntax:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Link Text</a>
This will open the link in a new window or tab, depending on the user's browser settings.
Here are some additional options you can use with the target
attribute:
_blank
: Open the link in a new window or tab._self
: Open the link in the same window or tab (default behavior)._parent
: Open the link in the parent frame (if the link is contained within a frame)._top
: Open the link in the full body of the window (if the link is contained within a frame).
For example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_parent">Link Text</a>
This will open the link in the parent frame, if the link is contained within a frame.
Note that the target
attribute only works for links that are not already in a frame. If you're linking to a page that is already in a frame, the target
attribute will not work as expected.
Also, be aware that some browsers may not support the target
attribute or may have different behaviors when opening links in new windows or tabs.