Base target attribute
Definition and usage
target
Sets or returns the value of the target attribute in the base element.
<base> target attribute Specify the default target for all hyperlinks and forms in the page.
See also:
HTML Reference Manual:HTML <base> Tag
Example
Example 1
Return the base target of all links on the page:
var x = document.getElementById("myBase").target;
Example 2
Change the base target of all links on the page to "_blank":
document.getElementById("myBase").target = "_blank";
Syntax
Return target attribute:
baseObject.target
Set target attribute:
baseObject.target = "_blank|_self|_parent|_top|framename"
Attribute value
Value | Description |
---|---|
_blank | Open links in a new window. |
_self | Open links within the same frame (default). |
_parent | Open links in the parent frame set. |
_top | Open links in the entire window. |
framename | Open links in named frames. |
Technical Details
Return Value: | A string value representing the default target for all hyperlinks and forms in the page. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <base> target Attribute