NavigationHistoryEntry:url 属性

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

NavigationHistoryEntry 接口的 url 只读属性返回此历史记录条目的绝对 URL。如果该条目对应的文档与当前文档不同(例如 sameDocument 属性为 false),并且该文档是在 Referrer-Policy 标头设置为 no-referrerorigin 的情况下获取的,则该属性返回 null。如果当前文档未完全激活,则返回一个空字符串。

表示 URL 的字符串或 null

示例

js
const current = navigation.currentEntry;
console.log(current.url);

规范

Specification
HTML
# dom-navigationhistoryentry-url-dev

浏览器兼容性

BCD tables only load in the browser

参见