Open new page html
To open a new page in HTML, you can use the <a>
tag with the target
attribute set to _blank
. This will open the linked page in a new tab or window.
Here is an example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Open in new page</a>
This will create a link that says "Open in new page" and when clicked, will open the page at https://www.example.com
in a new tab or window.
You can also use the rel
attribute to specify that the link should be opened in a new window, rather than a new tab. For example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank" rel="noopener">Open in new window</a>
This will create a link that says "Open in new window" and when clicked, will open the page at https://www.example.com
in a new window.
Note that the target
attribute can also be set to _self
to open the link in the same window, or _parent
to open the link in the parent frame (if the page is being displayed in a frame).
Here is a list of common values for the target
attribute:
_blank
: Open the link in a new tab or window_self
: Open the link in the same window_parent
: Open the link in the parent frame (if the page is being displayed in a frame)_top
: Open the link in the full body of the window (if the page is being displayed in a frame)
You can also use the onclick
event to open a new page when a button is clicked. For example:
<button onclick="window.open('https://www.example.com', '_blank')">Open in new page</button>
This will create a button that says "Open in new page" and when clicked, will open the page at https://www.example.com
in a new tab or window.