A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Proposal] `historychanged` event

isiahmeadows
2020-04-16

Currently, we only have onpopstate, and that event only fires on user-generated events. While this is fine if you encapsulate everything to just one history library and do everything through it, it doesn’t let people use history.pushState(someURL) while also using a routing library, for example.

How about a historychanged event that fires on every history change? This would be after the navigation changes, and the event object itself would have two properties, previousPath and previousState, each self-descriptive. This would fire any time the location changes without attempting navigation.

marcosc
2020-04-24

@domenic, maybe you could comment from a HTML editor’s perspective?

Malvoz
2020-05-19