# WebExtension - storage.local.clear() don't work

**URL:** <https://discourse.mozilla.org/t/webextension-storage-local-clear-dont-work/17471>\
**Category:** Development\
**Created:** [July 28, 2017, 9:55am UTC](https://discourse.mozilla.org/t/webextension-storage-local-clear-dont-work/17471 "2017-07-28T09:55:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ki3ie](https://avatars.discourse-cdn.com/v4/letter/k/aeb1de/32.png) [@Ki3ie](https://discourse.mozilla.org/u/Ki3ie)\
**Post date:** [July 28, 2017, 9:55am UTC](https://discourse.mozilla.org/t/webextension-storage-local-clear-dont-work/17471/1 "2017-07-28T09:55:01Z")

</div>

Hi,

When I tried to clear the storage.local, there is a problem.

1. I open a popup and I tried to clear.  
With this code : **browser.storage.local.clear();**  

2. It’s clear yeah ! But when I refresh the storage.local it’s back …  

Available here : [https://addons.mozilla.org/en-US/firefox/addon/navigation-stats-plus/](https://addons.mozilla.org/en-US/firefox/addon/navigation-stats-plus/)

So I really don’t know what happen. If anyone know it and can help me, thanks.

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [July 28, 2017, 8:31pm UTC](https://discourse.mozilla.org/t/webextension-storage-local-clear-dont-work/17471/2 "2017-07-28T20:31:34Z")

</div>

`browser.storage.local` is **not** `localStorage`!

> **[storage.local](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local)**
>
> Represents the local storage area. Items in local storage are local to the machine the extension was installed on.

> **[Window.localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)**
>
> The read-only localStorage property allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions.

---

<div class="post-metadata">

**Author:** ![yfdyh000](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/yfdyh000/32/30581_2.png) [@yfdyh000](https://discourse.mozilla.org/u/yfdyh000)\
**Post date:** [July 30, 2017, 3:56am UTC](https://discourse.mozilla.org/t/webextension-storage-local-clear-dont-work/17471/4 "2017-07-30T03:56:52Z")

</div>

Your hostNavigationStats has not been cleared, and it also reside in the background as global object.
