Reputation: 33
Currently I'm developing a Firefox extension. Now I need to store the values of two variables persistently so that the values can be accessed even if Firefox is restarted.
I already found the following ways to store data:
But isn't it a bit complicated to create a whole database just for two values? And maybe this sounds a bit strange but I do not really want to save the values in the Preferences because in fact they are just data and no preference.
I can't really decide which way would be best. How would you store the data? Are there perhaps other ways to store data of a Firefox extension?
Upvotes: 3
Views: 411
Reputation: 57651
Yes, you should use preferences, that's what they are good for. For small amounts of data that needs to be remembered they are the perfect solution. And you can easily access them on the about:config
page.
As to other methods of storing data: attributes in XUL documents can be persisted in localstore.rdf
. You can simply save data to a file (probably JSON-encoded). Well, you could even write your data into the Windows registry (no, not going to give a link to that). But using preferences should be the better solution nevertheless.
Upvotes: 2