I was reading this discussion and is says sessionStorage is supported on ankidroid, and after 2.1.50 on desktop. Does it also work on anki mobile or would anki persistence still be required?
@glutanimate you’d been planning to look into a unified API for the various platforms - is that still on the cards?
Is there a reason why you couldn’t just use anki persistence as an included script, kind of like jquery? It seems to work across devices already, and is a pretty simple script.
Edit: Well it seems mostly redundant now actually. Session storage seems to work on both desktop and ankidroid, but I’m assuming still not on ios.
AnkiDroid’s new study screen doesn’t “destroy variables” anymore just like Anki Desktop. If AnkiMobile works the same way, then the following trick should work:
You probably know this, but I just learned that localStorage, sessionStorage, and Anki Persistence are not really needed.
try { var_name; } catch(e) { if(e.name == "ReferenceError") { var_name = Math.random(); } }Due to the fact that Anki doesn’t destroy variables, the above code will assign a random number to
var_nameonly if it hasn’t already been declared.
From my recent discord comment.
It does work on AnkiMobile just as well. Here is a report of a solution based on sessionStorage working as expected: Element which stores the solution typed by the user - #18 by rean
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.