NavigationHistoryEntry: dispose event
Navigation API
Navigation API
The **`dispose`** event of the NavigationHistoryEntry interface is fired when the entry is no longer part of the history entry list.
Disposal occurs when:
- Forward history entries are cleared. See the example at [Notifications on entry disposal](https://github.com/wicg/navigation-api#notifications-on-entry-disposal) for more information.
- The user clears their browser history using settings or provided UI controls.
- The history limit is exceeded. This is not specified anywhere, but browsers tend to have a history limit of 50 pages.
## Syntax
Use the event name in addEventListener():
```js-nolint
addEventListener("dispose", (event) => { })
```
Alternatively, assign to the [event handler property](/docs/Web/API/Document_Object_Model/Events#using_onevent_properties) of the interface:
```js-nolint
ondispose = (event) => { }
```
## Event type
A generic Event.
## Examples
```js
navigation.addEventListener("currententrychange", () => {
navigation.currentEntry.addEventListener("dispose", disposeHandler);
});
```
## Specifications
## Browser compatibility
## See also
- [Modern client-side routing: the Navigation API](https://developer.chrome.com/docs/web-platform/navigation-api/)
- [Navigation API explainer](https://github.com/WICG/navigation-api/blob/main/README.md)
Cite this
"NavigationHistoryEntry: dispose event". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/NavigationHistoryEntry/dispose_event JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy