In HTML opening link in a new window is very easy and frequently achieved functionality.
In order to open link in a new window we use the target attribute of the HTML area(<area>) tag.
Note: HTML Area Tag Target Attribute is used only if the HTML Area Href Attribute is used.
Syntax of using HTML Area Tag Target Attribute
<area target =”_blank|_self|_parent|_top|frame_name”>
Here in the above syntax the values for the HTML Area target Attribute mean the following:
Value | Description |
_blank | Opens the linked resource/webpage in a new window or tab |
_self | Opens the linked resource/webpage in the same frame as it was clicked (this is default) |
_parent | Opens the linked resource/webpage in the parent frame |
_top | Opens the linked resource/webpage in the full body of the window |
framename | Opens the linked resource/webpage in a named frame |
Also note that by default the _self value will be set for the target attribute i.e. if we do not mention the target attribute in the HTML area tag then the linked resource/webpage will open in the same frame in which the link was clicked.
Examples of Using the HTML Area Tag Target Attribute
HTML Open link in a new window:
HTML Area Tag Target Attribute Code | Output | ||||||||||||||||||||||
|
Click on the shapes to watch them:![]() |
Here in the above HTML area target attribute example we have mentioned that once the certain portion of the image is clicked the respective image should open in a new browser window or tab by giving target attribute a value of _blank.
HTML Area Target Attribute Supporting Browsers
S. No. | Browser | Supported(Yes/No) |
1 | Internet Explorer | Yes |
2 | Firefox | Yes |
3 | Google Chrome | Yes |
4 | Opera | Yes |
5 | Safari | Yes |