• The target attribute in hyperlinks is used to specify where the linked web page or resource should open.
• By default, hyperlinks open in the same browser tab or window, replacing the current page.
• You can use the target attribute to control how the link behaves when clicked.
• The common values for the target attribute are "_blank" to open the link in a new browser tab, and "_self" to open it in the same tab (default).
• For example, Click here you will be redirected to JTC home page in a new browser tab.
<!DOCTYPE html>
<html>
<head>
<title>HTML Hyperlink</title>
</head>
<body>
<h2>Target Attribute</h2>
<a href="https://www.jtcindia.org" target="_blank">Click here!!JTC home page will open in a new tab</a>
</body>
</html>
Some Other target Atrributes
option | Description |
---|---|
_blank | Opens the linked resource in a new browser tab or window. |
_self | (Default) Opens the linked resource in the same window or frame where the link was clicked. |
_parent | Opens the linked resource in the parent frame, useful when the page is in a nested frame structure. |
_top | Opens the linked resource in the full body of the window, breaking out of any frames. |
framename | Opens the linked resource in a specific named frame, if it exists. |