# Browser.storage.local is not persistent

**URL:** <https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554>\
**Category:** Development\
**Tags:** learning\
**Created:** [April 5, 2022, 5:02pm UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554 "2022-04-05T17:02:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![elnath78](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/elnath78/32/23893_2.png) [@elnath78](https://discourse.mozilla.org/u/elnath78)\
**Post date:** [April 5, 2022, 5:02pm UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/1 "2022-04-05T17:02:31Z")

</div>

I noticed that every time I launch the browser and load my extension, the storage is somewhat reset, is this due to the fact that I’m debugging it or do I need sort of save the storage after putting in the data?

---

<div class="post-metadata">

**Author:** ![ComputerWhiz](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/computerwhiz/32/20011_2.png) [@ComputerWhiz](https://discourse.mozilla.org/u/ComputerWhiz)\
**Post date:** [April 5, 2022, 10:40pm UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/2 "2022-04-05T22:40:42Z")

</div>

As long as you are using browser.storage.local.set() to save items to the storage, it should be persistent. If you are loading it as a temporary add-on for debugging, that’s probably why it’s resetting.

---

<div class="post-metadata">

**Author:** ![EternalStudent07](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@EternalStudent07](https://discourse.mozilla.org/u/EternalStudent07)\
**Post date:** [April 6, 2022, 4:05am UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/3 "2022-04-06T04:05:57Z")

</div>

Isn’t the temporary add-on scenario the only option for most Android developers?

I haven’t tried it yet, but I’m surprised this is the expected process.

> <https://github.com/mozilla-mobile/fenix/issues/18135>
>
> \### What is the user problem or growth opportunity you want to see solved?
> 
> It i…s impossible to install unlisted Web Extensions in Firefox Nightly.
> 
> Currently, in order to use a simple custom extension in Nightly, one has to:
> 
> 1) Create a Firefox Account;
> 2) Create a collection;
> 3) Upload the extension to be listed at addons.mozilla.org (unlisted extensions CANNOT be installed);
> 4) Waste the time of the reviewer to look at the extension;
> 5) Pollute the add-on database with an extension that is of very little use to the general public.
> 
> Curiously, issue #11308, which raised roughly the same issue, was closed as a duplicate of #14034, which is now closed and did not address this specific problem.
> 
> ┆Issue is synchronized with this \[Jira Task\](https://mozilla-hub.atlassian.net/browse/FNXV2-9794)

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [April 6, 2022, 9:18am UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/4 "2022-04-06T09:18:01Z")

</div>

Do you have an id defined in your manifest? If not, every time you load the extension temporarily Firefox will treat it as an entirely new extension.

---

<div class="post-metadata">

**Author:** ![elnath78](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/elnath78/32/23893_2.png) [@elnath78](https://discourse.mozilla.org/u/elnath78)\
**Post date:** [April 6, 2022, 10:59am UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/5 "2022-04-06T10:59:40Z")

</div>

Yes I defined an Extension ID, but I think it is based on UUID and it seems it is random for temporary extensions, I’m wondering were all those left overs are saved using up disk space.

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [April 6, 2022, 11:01am UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/6 "2022-04-06T11:01:36Z")

</div>

Firefox should manage storage properly automatically.

I just noticed that [https://extensionworkshop.com/documentation/develop/testing-persistent-and-restart-features/](https://extensionworkshop.com/documentation/develop/testing-persistent-and-restart-features/) outlines some prefs you can toggle if you want to test `storage.local` with persistence with an unsigned extension.

---

<div class="post-metadata">

**Author:** ![elnath78](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/elnath78/32/23893_2.png) [@elnath78](https://discourse.mozilla.org/u/elnath78)\
**Post date:** [April 6, 2022, 11:22am UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/7 "2022-04-06T11:22:34Z")

</div>

> [@freaktechnik](#):
>
> I just noticed that [Testing persistent and restart features | Firefox Extension Workshop](https://extensionworkshop.com/documentation/develop/testing-persistent-and-restart-features/) outlines some prefs you can toggle if you want to test `storage.local` with persistence with an unsigned extension.

Where are you reading this? I read only `set an add-on ID using the browser_specific_settings key` which I have done.

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [April 6, 2022, 12:19pm UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/8 "2022-04-06T12:19:43Z")

</div>

> **[Testing persistent and restart features](https://extensionworkshop.com/documentation/develop/testing-persistent-and-restart-features/#what-do-i-do-to-ensure-i-can-test-my-extension)**
>
> Get help creating & publishing Firefox extensions.

---

<div class="post-metadata">

**Author:** ![elnath78](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/elnath78/32/23893_2.png) [@elnath78](https://discourse.mozilla.org/u/elnath78)\
**Post date:** [April 6, 2022, 1:22pm UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/9 "2022-04-06T13:22:33Z")

</div>

I have already read this, it say to us an Extension ID, i have this in my manifest file.

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [April 6, 2022, 1:32pm UTC](https://discourse.mozilla.org/t/browser-storage-local-is-not-persistent/95554/10 "2022-04-06T13:32:23Z")

</div>

> - to preserve `storage.local` data, access to `window.localStorage` or `indexedDB` data when removing a temporary add-on (such as between browser restarts):
> - go to `about:config` and set both  
> `extensions.webextensions.keepStorageOnUninstall` and  
> `extensions.webextensions.keepUuidOnUninstall` to `true` .
