THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Base target Property

Base Object Reference Base Object

Example

Return the base target for all links on a page:

var x = document.getElementById("myBase").target;

The result of x will be:

_self
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

Internet Explorer Firefox Opera Google Chrome Safari

The target property is supported in all major browsers.


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 Reference Base Object