Sometimes, we want to get notified about changes of the history via history.pushState with JavaScript.
In this article, we’ll look at how to get notified about changes of the history via history.pushState with JavaScript.
How to get notified about changes of the history via history.pushState with JavaScript?
To get notified about changes of the history via history.pushState with JavaScript, we can listen for changes in webNavigation.onHistoryStateUpdated
.
To do this, we write
browser.webNavigation.onHistoryStateUpdated.addListener(listener, filter);
to call browser.webNavigation.onHistoryStateUpdated.addListener
with the listener
to listen for history.pushState
calls with the listenr
function.
Conclusion
To get notified about changes of the history via history.pushState with JavaScript, we can listen for changes in webNavigation.onHistoryStateUpdated
.