NavigationActivation:navigationType 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
NavigationActivation
接口的 navigationType
只读属性包含一个表示导航类型的字符串。
值
表示 NavigationActivation
所关联的导航类型的字符串。可能的值包括:
push
:导航到新位置,导致新条目被推送到历史记录列表中。reload
:重新加载NavigationActivation.entry
。replace
:用新历史记录条目替换NavigationActivation.entry
。此新条目将重用相同的key
,但分配不同的id
。traverse
:浏览器从一个现有历史记录条目导航到另一个现有历史记录条目。
示例
js
window.addEventListener("pageswap", (event) => {
// 例如,页面被隐藏,或者导航是跨文档的。
if (!event.viewTransition) return;
// 跳过后退/前进导航的视图转换。
if (event.activation.navigationType === "traverse") {
event.viewTransition.skipTransition();
}
});
规范
Specification |
---|
HTML # dom-navigationactivation-navigationtype |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
navigationType |
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.
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.