Location: href property - Web APIs | MDN

Value

A string.

Examples

js

// Lets imagine an <a id="myAnchor" href="https://developer.mozilla.org/en-US/Location/href"> element is in the document
const anchor = document.getElementById("myAnchor");
const result = anchor.href; // Returns: 'https://developer.mozilla.org/en-US/Location/href'

Specifications

Specification
HTML
# dom-location-href-dev

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.