HTML DOM Base target Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

Base target Property

❮ Base Object

Example

Return the base target for all links on a page:

var x = document.getElementById("myBase").target;
Try it Yourself »

Definition and Usage

The target property sets or returns the value of the target attribute in a base element.

The target attribute specifies the default target for all hyperlinks and forms in the page.


Browser Support

Property
target Yes Yes Yes Yes Yes


Syntax

Return the target property:

baseObject.target

Set the target property:

baseObject.target = "_blank|_self|_parent|_top|framename"

Property Values

Value Description
_blank Open links in a new window
_self Open links in the same frame as it was clicked (this is default)
_parent Open links in the parent frameset
_top Open links in the full body of the window
framename Open links in a named frame

Technical Details

Return Value: A String, representing the default target for all hyperlinks and forms in the page

More Examples

Example

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

document.getElementById("myBase").target = "_blank";
Try it Yourself »

Related Pages

HTML reference: HTML <base> target attribute


❮ Base Object