Base target attribute

Definition and usage

target Set or return 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;

Try it yourself

Example 2

Change the base target of all links on the page to "_blank":

document.getElementById("myBase").target = "_blank";

Try it yourself

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 in 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: String value, representing the default target for all hyperlinks and forms on 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