LocalStorage in Firefox Extension

Does Firefox have a Personal LocalStorage extension? And how can I access it? I know about window.content.localStorage , but this is the specific localStorage of the current page, and not like in Google Chrome, where each extension has a personal background page.

+4
source share
2 answers

You can use the simple-storage module to store content specifically for your add-on that is not tied to a specific page, for example localStorage, and you can also use the indexed-db module , which is a little more reliable, and we are backing away from simple storage.

+5
source

a simple repository would be an ideal solution, but if you use the Add-on Builder Helper , this is not ideal, because the repository gets every time you make changes to the code and restart the application. Thus, it is impossible to verify that your code is working correctly without creating an extension and testing it in another browser profile, which makes it difficult to configure the code and make minor changes.

Instead, I used the simple-prefs module, which really persisted through reboots:

 var prefs = require("simple-prefs").prefs; 

The disadvantage is that everything needs to be serialized as a string, so the development overhead is a bit more complicated, but once you set it up, you can more easily test your code without creating XPI for every minor change, something that should help you avoid add-on builder.

+3
source

All Articles