Skip to main content
IHTMLAnchorElement::target Property

Sets or retrieves the window or frame at which to target content.


HRESULT IHTMLAnchorElement::get_target(BSTR *p);
HRESULT IHTMLAnchorElement::put_target(BSTR v);


Pointer to a variable of type BSTR that receives one of the values listed in Possible Values.
BSTR that specifies one of the values listed in Possible Values.

Possible Values

_blankLoad the linked document into a new blank window. This window is not named.
_mediaDisabled in Windows XP Service Pack 2 (SP2) and later versions; otherwise, loads the linked document into the HTML content area of the Media Bar. Available in Microsoft Internet Explorer 6.
_parentLoad the linked document into the immediate parent of the document the link is in.
_searchDisabled in Windows Internet Explorer 7, see Security and Compatibility in Internet Explorer 7 for details. Otherwise, loads the linked document into the browser search pane in Internet Explorer 5 or later.
_selfDefault. Load the linked document into the window in which the link was clicked (the active window).
_topLoad the linked document into the topmost window.
name The name of the target window or frame.

Return Value

Returns S_OK if successful, or an error value otherwise.


If there is no existing window or frame with the same name as specified in the IHTMLAnchorElement::target, a new window is opened with a name equal to the value of the IHTMLAnchorElement::target.

Internet Explorer 8 and later. When Protected Mode is enabled and a webpage contains an anchor link with a named IHTMLAnchorElement::target, Internet Explorer opens the target of the link in a new window when the target has a different integrity level than the webpage containing the link. For more information, see Understanding and Working in Protected Mode Internet Explorer.

In Internet Explorer 6, the value of the IHTMLAnchorElement::target parameter of this property specifies that a linked document loads in the content area of the IHTMLAnchorElement::target.