DEV Community

Cover image for Chrome Local Storage in Extensions

Chrome Local Storage in Extensions

milandhar on June 24, 2019

For my Javascript project at Flatiron School's Web Development course, my partner and I decided to build a Chrome extension. When we got the projec...
Collapse
 
nutondev profile image
nuton.dev

My understanding is that the total quota of storage.local (about 5 MB?) is shared among all extensions, so potentially in case one extension eats up 5MB, I won't be able to store my data. Is that correct? Also, since the storage API includes .clear() my understanding is that the scope is per extension and there is no need to namespace the settings, correct? (otherwise you would be able to clear storage area belonging to other extensions)

Collapse
 
ws647487t profile image
ws647487t

IT'S OBVIOUS!

Collapse
 
thenora profile image
thenora

I'd love to take a look at your git -- I'm working on a Pomodoro timer Chrome extension using React, and working on deciding between using local storage or messaging. I haven't seen too many examples with local storage, which is what I think I'm leaning toward.

Collapse
 
rhythm010 profile image
rhythm010

If I want to store some data for the chrome extension that stays even when the browser window is closed, what kind of storage should be useful then.

Collapse
 
milandhar profile image
milandhar

Chrome's local storage can persist when the window closes. You can use either storage.local or storage.sync to accomplish that.

Collapse
 
likejean profile image
likejean

Where this manifest.json file should be kept? At the root directory of the application?

Collapse
 
milandhar profile image
milandhar

Hi - yes, it should be kept in the root directory. Here is more info on the manifest.json file: developer.chrome.com/extensions/ma...