In my extension, I have a collection of around 350 lines of static JSON data. This data is essential for the functioning of a content script, as it consists of key-value pairs that are checked upon user interaction to trigger specific actions. Here's an example snippet:
{
"ABC": 323.32,
"BDS": 23.12,
"GTO": 96.52
}
Now, I'm contemplating the best location to store this data. Three ideas come to mind:
- Embedding it directly within the content script.
- Loading it in an Event Page and utilizing Message Passing to access the information.
- Storing it in a JSON file and finding a way to retrieve it using XHR. Although, I believe this option may not be feasible.
While I am aware of technologies like localStorage
and various storage types provided by Chrome, they seem more suitable for data generated during user interactions with the extension.
This JSON data remains static once the extension is installed until potential updates modify it. Currently, the data resides within the content script which is loaded each time a page is opened despite its unchanging nature. Considering this, would an Event Page be a better choice or is there a purpose-built solution for managing this type of static data?