# localStorage is apparently not working anymore on AnkiDesktop

**URL:** <https://forums.ankiweb.net/t/localstorage-is-apparently-not-working-anymore-on-ankidesktop/46160>\
**Category:** Help\
**Created:** [June 17, 2024, 8:46pm UTC](https://forums.ankiweb.net/t/localstorage-is-apparently-not-working-anymore-on-ankidesktop/46160 "2024-06-17T20:46:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duude](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/duude/32/21017_2.png) [@Duude](https://forums.ankiweb.net/u/Duude)\
**Post date:** [June 17, 2024, 8:46pm UTC](https://forums.ankiweb.net/t/localstorage-is-apparently-not-working-anymore-on-ankidesktop/46160/1 "2024-06-17T20:46:53Z")

</div>

Apparently AnkiDesktops localStorage is not working anymore?  
I updated to the newest version and certain options from my templates are not being saved anymore.

If anyone wants to recreate this problem:

```auto
<script>
var STORAGE_KEY = "example-storage-location";

var existing_storage = localStorage.getItem(STORAGE_KEY);
if (existing_storage === null) 
{
    existing_storage = 0;
} else 
{
    existing_storage = parseInt(existing_storage);
}

console.log("This template has been accessed " + existing_storage + " times.");

existing_storage = existing_storage + 1;

localStorage.setItem(STORAGE_KEY, existing_storage);
console.log(STORAGE_KEY + " set to " + existing_storage);
</script>

```

This is a modification of the code from a testcase for the same bug on AnkiDroid: [[BUG]: localStorage does not seem to be persistent in version 2.17.5 · Issue #15911 · ankidroid/Anki-Android · GitHub](https://github.com/ankidroid/Anki-Android/issues/15911).

This here is happening on AnkiDesktop too! After restarting Anki completely, the localStorage is wiped.

Is anyone able to recreate this problem? I don’t want to open a bug entry on gitHub, when there is still a chance that I am the only one affected by it.

I am using the newest Version of Anki (24.06.2-windows-qt6)

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [June 18, 2024, 3:27pm UTC](https://forums.ankiweb.net/t/localstorage-is-apparently-not-working-anymore-on-ankidesktop/46160/2 "2024-06-18T15:27:51Z")

</div>

localStorage has never been persistent between runs in Anki Desktop as far as I know. Using a persistent [QWebEngineProfile](https://doc.qt.io/qt-6/qwebengineprofile.html) will probably solve this.

---

<div class="post-metadata">

**Author:** ![Duude](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/duude/32/21017_2.png) [@Duude](https://forums.ankiweb.net/u/Duude)\
**Post date:** [June 18, 2024, 4:21pm UTC](https://forums.ankiweb.net/t/localstorage-is-apparently-not-working-anymore-on-ankidesktop/46160/3 "2024-06-18T16:21:27Z")

</div>

Oh. Yeah well. Then maybe I got confused along with AnkiDroid. This feature on AnkiDroid is really great for settings created with JavaScript for the template itself.

---

<div class="post-metadata">

**Author:** ![Duude](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/duude/32/21017_2.png) [@Duude](https://forums.ankiweb.net/u/Duude)\
**Post date:** [June 18, 2024, 4:30pm UTC](https://forums.ankiweb.net/t/localstorage-is-apparently-not-working-anymore-on-ankidesktop/46160/4 "2024-06-18T16:30:56Z")

</div>

For anyone that wants localStorage to be integrated into AnkiDesktop.  
Here is an older thread: [Can Anki provide cross platform local persistent storage functionality? - #4 by dae](https://forums.ankiweb.net/t/can-anki-provide-cross-platform-local-persistent-storage-functionality/44743/4).  
You can voice your ideas or approval for localStorage on AnkiDesktop there.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [July 18, 2024, 4:31pm UTC](https://forums.ankiweb.net/t/localstorage-is-apparently-not-working-anymore-on-ankidesktop/46160/5 "2024-07-18T16:31:02Z")

</div>

Closed on July 18, 2024, 4:31pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
