Replacing content_scripts to activeTab but still giving optional permission

I’ve developed an addon which is written for both Firefox and Chrome. It currently has permission of <all_urls>.

I wanted to move away from using this broad level permission by default and give users an optional permission so that they can choose whether to use the extension with this permission or just with activeTab permission.

What are some best practices that I should consider.

I’ve raised this stackoverflow post, if you need more details.

Also, I’m looking for a browser independent suggestion, so that I can release the same codebase to all browser.

Thank you in advance for any help/suggestion.

I don’t think I know enough about your extension to say what you should do.

Is your content script useful if it runs purely on demand when the user calls it from a right-click context menu item or toolbar button? In that case, you can use insertCSS() and executeScript() as illustrated here: