To execute a function when there is a change in the URL, you can use the browser.webNavigation.onHistoryStateUpdated API. Here's how you can use it in your add-on:
"permissions": [
"webNavigation"
]
browser.webNavigation.onHistoryStateUpdated.addListener(function(details) {
// execute your function here
});
The details
parameter contains information about the navigation event, including the new URL. You can use this information to determine if your function should be executed.
Note that this event fires when the user navigates forward or backward, as well as when navigating between pages using links or the address bar.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-06 21:12:37 +0000
Seen: 10 times
Last updated: May 06 '23
Why does my method execute only once within a while loop?
What is the syntax for creating an If statement that involves a boolean value?
Is it possible to execute a single command to assume an AWS STS role?
Is it necessary to execute a Node Script first before launching the React application?
How can I make and execute a Go build specifically for Mac operating systems?
Why do certain Macro VBA Excel 2019 scripts fail to execute on Excel 2013?