I’m developing an extension that should synchronize data between two third-party websites (the user performs actions on one website, and a report on these actions is sent to the other website).
I would like to insert the widget into the interface of the first website. I do this by content_script
.
I have added the necessary URLs to the host_permissions
. But they are disabled by default. Okay. But when the user clicks the “Synchronise” button, I need to ask him for this permission to access this URL.
How do I do this? I can’t call browser.permissions.request
in the content_script
. I tried sending a message to the background script when user click button and requesting permissions from there, but I get an error: permissions.request may only be called from a user input handler
So, what should I do?