NavigationHistoryEntry:id 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
NavigationHistoryEntry
接口的 id
只读属性返回历史条目的 id
,如果当前文档未完全激活,则返回空字符串。这是一个唯一的 UA 生成值,始终代表特定历史条目,可用于将其与外部资源(如存储缓存)关联。
这与历史条目的 key
不同。key
是一个唯一的 UA 生成值,代表历史条目在条目列表中的位置,而不是条目本身。它用于通过 Navigation.traverseTo()
导航该特定位置。key
将被替换列表中条目的其他条目重用(即,如果 NavigateEvent.navigationType
为 replace
)。
值
表示 NavigationHistoryEntry
的 id
的字符串。
示例
js
const current = navigation.currentEntry;
console.log(current.id);
规范
Specification |
---|
HTML # dom-navigationhistoryentry-id-dev |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
参见
- 现代客户端路由:导航 API
- 导航 API 说明
- Domenic Denicola 的导航 API 在线演示