Menu

1 / 2

Browser Storage for Firefox Extensions: localStorage vs IndexedDB vs storage.local

DEV Community·Weather Clock Dash·6 months ago
#o7ru4oxP
Reading 0:00
15s threshold

Browser Storage for Firefox Extensions: localStorage vs IndexedDB vs storage.local

One of the first decisions when building a browser extension is where to store data. There are more options than you might expect, each with distinct tradeoffs.

The Options

localStorage — synchronous, 5-10MB limit, per-origin

sessionStorage — same as localStorage but clears on session end

IndexedDB — async, larger limits, supports complex queries

browser.storage.local — async, up to 10MB by default, extension-isolated

browser.storage.sync — synced across devices, 100KB limit, quota per item

browser.storage.session — in-memory, cleared on extension restart (MV3 only)

When to Use What

browser.storage.local — The Default Choice for Extensions

// Store data await browser . storage . local . set ({ weatherData : { temp : 72 , city : ' San Francisco ' }, lastUpdated : Date . now () });

// Read data const { weatherData , lastUpdated } = await browser . storage . local .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.