Html open in new window
To open an HTML link in a new window, you can use the target
attribute and set its value to _blank
. Here's an example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Open in new window</a>
This will open the link in a new browser window when the user clicks on it.
You can also use other values for the target
attribute, such as:
_self
: Opens the link in the same window (default behavior)_parent
: Opens the link in the parent frame (if the link is in a frame)_top
: Opens the link in the full body of the window (if the link is in a frame)_blank
: Opens the link in a new window or tab
Note that the target
attribute only works for links that are not in a frame. If you want to open a link in a new window from within a frame, you'll need to use JavaScript to achieve this.
Here's an example of how you can use JavaScript to open a link in a new window:
<a rel="nofollow" target="_blank" href="https://www.example.com" onclick="window.open(this.href, '_blank'); return false;">Open in new window</a>
This will open the link in a new window when the user clicks on it, and prevent the default link behavior from occurring.