Reputation: 139
I'm developing an extension that is managed by server, and I need to store local data to use when Chrome is offline. I know it sounds terrible, but it's a management extension, I need it.
For this purpose I can use:
- chrome.storage API, but users can easily remove all data and my offline management fails.
- webSQL, same problem as chrome.storage.
- write a file, but users can still remove the file.
Is there something else that I can use that isn't easily removed by users?
Thanks
Upvotes: 2
Views: 608
Reputation: 73506
You can try abusing chrome.alarms API:
JSON.stringify()
of your data. If you'll reach some internal length limit you can make many of these distant alarms. And if your data is extremely big but is repetitive and thus compressible, use some lz or zip library to pack it, then convert to base64 string and use it as an alarm name.chrome.alarms.getAll
I suppose this won't survive temporary disabling of the extension, but you should use those other standard methods for redundancy, and use whichever survives to restore the cleared ones.
Upvotes: 2