URL.href

URL 接口的 href 属性是一个包含完整 URL 的 USVString 值。

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

语法

string = object.href;
object.href = string;

返回值

示例

js
var url = new URL("https://developer.mozilla.org/zh-CN/docs/Web/API/URL/href");
var result = url.href; // Returns: '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 接口。