URL:href 属性

备注: 此特性在 Web Worker 中可用。

URL 接口的 href 属性是包含整个 URL 的字符串。

字符串。

示例

js
const url = new URL(
  "https://developer.mozilla.org/zh-CN/docs/Web/API/URL/href",
);
console.log(url.href); // 输出:'https://developer.mozilla.org/zh-CN/docs/Web/API/URL/href'

规范

Specification
URL Standard
# dom-url-href

浏览器兼容性

BCD tables only load in the browser

参见

  • 所属的 URL 接口。