2.3.1.30 href

Quirks Mode, IE7 Mode, IE8 Mode, IE9 Mode, IE10 Mode, and IE11 Mode (All Versions)

href of type DOMString

Sets or retrieves a destination URL or an anchor point.

For Windows Internet Explorer 8 or later, when the browser is in Internet Explorer 8 mode, the value of the href depends on the context of the reference to the attribute. When read as a Document Object Model (DOM) attribute, href returns a URL relative to the domain hosting the webpage. When the page is displayed in an earlier document compatibility mode, or the page is viewed with an earlier version of the browser, href is read as a content attribute and returns the value specified by the page author

For Internet Explorer 8 or later, when Protected Mode is enabled and a webpage contains an anchor link that has a named target, Windows Internet Explorer opens the target of the link in a new window when the target has a different integrity level than the webpage that contains the link.

The img element does not support the href content attribute. In addition, the href property is read-only for the img DOM object.

If href is specified as a blank value (href="" or href=), executing the link might display the directory that contains the current page, or it might generate an error, depending on other elements on the webpage and the server environment.

This attribute extends the HTMLImageElement interface.

Show: