const filter = {
url: [{ hostContains: "example.com" }, { hostPrefix: "developer" }],
};
function logOnHistoryStateUpdated(details) {
console.log(`onHistoryStateUpdated: ${details.url}`);
console.log(`Transition type: ${details.transitionType}`);
console.log(`Transition qualifiers: ${details.transitionQualifiers}`);
}
browser.webNavigation.onHistoryStateUpdated.addListener(
logOnHistoryStateUpdated,
filter,
);webNavigation.onHistoryStateUpdated / notebook
webNavigation.onHistoryStateUpdated
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.