Change the target of a link to "_blank" (the link will be opened in a new window):
The target property sets or returns the value of the target attribute of a link.
The target attribute specifies where to open the linked document.
The target property is supported in all major browsers.
Return the target property:
Set the target property:
Value | Description |
---|---|
_blank | Opens the linked document in a new window |
_self | Opens the linked document in the same frame as it was clicked (this is default) |
_parent | Opens the linked document in the parent frameset |
_top | Opens the linked document in the full body of the window |
framename | Opens the linked document in a named frame |
Return Value: | A String, representing where to open the linked document |
---|
Return the value of the target attribute of a link:
The result of x will be:
HTML reference: HTML <a> target attribute