If I understand correctly, popup.html and background.html share the same local storage since they run in the same sandbox. And content script does not share the same one since it run in another sandbox. Right?
Items in local storage are local to the machine the extension is installed on. The browser may restrict the amount of data that an extension can store in the local storage area. For example: In Chrome, an extension is limited to storing 5MB of data using this API unless it has the "unlimitedStorage" permission.
Local storage is part of the HTML5 Web Storage API and it allows you to store data in the browser. Unlike cookies, data stored using local storage isn't sent back to the server. All data stays on the client, and you can currently store from 2MB to 10MB.
When using storage. sync , the stored data will automatically be synced to any Chrome browser that the user is logged into, provided the user has sync enabled. When Chrome is offline, Chrome stores the data locally. The next time the browser is online, Chrome syncs the data. Even if a user disables syncing, storage.
Each extension has a "Inspect views: background page" link for this. With the extension's background page open, just go to the developer tools by pressing F12, then go to the Application tab. In the Storage section expand Local Storage. After that, you'll see all your browser's local storage there.
Correct. Calling localStorage
from a Chrome extension's Background page, Browser Action page or Page Action page uses the extension's local storage.
Content scripts only run on normal web pages and generally can't access Chrome's extension API, so their local storage access would be limited to the specific website's local storage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With