NavigationHistoryEntry:dispose 事件

Limited availability

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

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

NavigationHistoryEntry 接口的 dispose 事件在条目不再是历史记录条目列表的一部分时触发。

处置发生在以下情况:

  • 清除前进历史条目。有关更多信息,请参阅条目处置通知中的示例。
  • 用户使用设置或提供的 UI 控件清除其浏览器历史记录。
  • 超出历史记录限制。这在任何地方都没有指定,但浏览器的历史记录限制往往为 50 页。

语法

在诸如 addEventListener() 之类的方法中使用事件名称,或设置事件处理器属性。

js
addEventListener("dispose", (event) => {});

ondispose = (event) => {};

事件类型

通用的 Event

示例

js
navigation.addEventListener("currententrychange", () => {
  navigation.currentEntry.addEventListener("dispose", disposeHandler);
});

规范

Specification
HTML
# handler-navigationhistoryentry-ondispose

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
dispose event
Experimental

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.

参见