eBlogzilla

Sunday, April 11, 2010

How to Store Complex Objects in Firefox

There are a couple of ways which can be used to store data in Firefox. First of all, you can use SQLite to store all your data. But in most of cases you don't need such powerful approach.

Basic data types can be stored in Application.storage or in preferences. But what to do if you need to store complex data?

In those cases when performance is not very critical for you, you ca use the next trick: encode with JSON your data and store it as result string. When you will need to access stored data, simply decode it back from string and enjoy!