NavigationDestination:id 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
NavigationDestination
接口的 id
只读属性在 NavigateEvent.navigationType
为 traverse
时返回目标 NavigationHistoryEntry
的 id
值,否则返回空字符串。
id
是一个唯一的、由 UA 生成的值,始终代表历史记录条目,可用于将历史记录条目与外部资源(如存储缓存)关联起来。
值
表示目标 NavigationHistoryEntry
的 id
的字符串,或者一个空字符串。
示例
js
navigation.addEventListener("navigate", (event) => {
console.log(event.destination.id);
});
规范
Specification |
---|
HTML # the-navigationdestination-interface:dom-navigationdestination-id-2 |
浏览器兼容性
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 在线演示