0
votes

I'm trying to build a firefox addon using the latest Addon Builder tool (https://builder.addons.mozilla.org/)

To access global preferences we can make use of simple-prefs api (https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/simple-prefs.html)

But how can we set page specific preferences for our addon?

eg. Firebug allows users to disable/enable panel for different pages.

2
Can you be more specific - do you implement new page-specific preferences, or ones that the user has already set in some other way? Please provide more info on your use case. - therealjeffg
@canuckistani: clarified question.. I'm trying to implement new page-specific preferences - everlasto

2 Answers

0
votes

Depending on what you're doing, you can look at the tabs a user has open, and also the active tab to change the behaviour of your add-on for that specific page. Add-ons can exist completely independent of pages and tabs (like a page-worker in the background), or they can affect pages visited (like a page-mod). Depending on your add-on, you can interpret the preferences set and determine what 'page' a user is on from tabs.

0
votes

To save page specific data, you should use a file or a database to store it. You can use simple-storage or something similar (indexeddb module).

Then you add an event listener to the page load, and you check in your database for that page's preferences, and act accordingly.