Tags
HTML
Asked 2 years ago
20 May 2021
Views 344
samir

samir posted

target="_blank" in html

i put target="_blank" in html

<a href="url"target="_blank" ></a> 

i dont know what is use of target attribute ?
duglus

duglus
answered Nov 30 '-1 00:00


<a href="url" target="_top" ></a> 


_top stands for the top parent of the window, suppose you have window in window than it will open in a first highest parent window

suppose if not parent then it will open in a self window so it work like same is _self


jaydeep

jaydeep
answered Nov 30 '-1 00:00

target is <a> element 's attribute , it can be used with only <a> element

by target attribute, you can define that given <a> attribute href url open in which manner, i mean either it can be open in window/tab or in parent frame or in the same window or in another iframe, etc.. it simply instruct to HTML that how to open given URL of <a>


<a href="url" target="_blank" ></a> 



it will open "url" in a new tab in a current browser window or it can open in a new window

so possible use of the attribute target is as below :


<a target="_blank|_self|_parent|_top|framename">


_blank means open in new tab or window
_self means open in same window or tab which is the default it means if you don't apply any value to target attribute of <a> element, it will open in same window or tab by default
_parent mean it will open in parent frame
_top means it will open in in the full body of the window
framename mean it will open in a given frame,
Post Answer