Sets or retrieves a destination URL or an anchor point.
HRESULT value = object.put_href( v);HRESULT value = object.get_href(* p);
the URL or anchor point.
- Document Object Model (DOM) Level 1 Specification, Section 2.5.5
- HTML 4.01 Specification, Section 12.2
When specified for an a element (also called an anchor element), IHTMLAnchorElement::href defines a link to another document or another location within the document containing the a element. By default, the text between the opening and closing tags of the anchor element is underlined and the location specified by the IHTMLAnchorElement::href attribute is loaded when the user activates the link.
The value of the IHTMLAnchorElement::href can be a URL that loads a separate document when the link is activated, or a fragment identifier. Fragment identifiers, orbookmarks, define target locations within a document that are brought into view when links are activated. Use the IHTMLFrameBase::name attribute of a separate anchor element to define a bookmark as a target location within a document.
If IHTMLAnchorElement::href is specified as a blank value (
href=), executing the link might display the directory containing the current document, or it might generate an error, depending on other elements in the document and the server environment.
Windows Internet Explorer 8 or later. In IE8 Standards mode, the value of the IHTMLAnchorElement::href depends on the context of the reference to the attribute. When read as a Document Object Model (DOM) attribute, IHTMLAnchorElement::href returns a URL relative to the domain hosting the Web page. IHTMLAnchorElement::href returns the value specified by the page author when read as a content attribute when the page is displayed in an earlier document compatibility mode, or when the page is viewed with an earlier version of the browser. For more information, see Attribute Differences in Internet Explorer 8.
Internet Explorer 8 and later. When Protected Mode is enabled and a Web page contains an anchor link with a named IHTMLAnchorElement::target, Windows Internet Explorer opens the target of the link in a new window when the target has a different integrity level than the Web page containing the link. For more information, see Understanding and Working in Protected Mode Internet Explorer.