[pmwiki-users] Local Storage

kirpi at kirpi.it kirpi at kirpi.it
Sun Jul 19 17:15:53 CDT 2015


Local Storage [1] is an easy and practical html5 tool, yet I am not
sure that I understand how to move its values to and from PTVs.
Actually, moving a value from a PTV to Local Storage seems to be easy,
more or less along this line:

   (:html:)<script>localStorage.setItem("my_variable",
"{$:My_variable}");</script>(:htmlend:)

Instead, I completely fail to move a value from Local Storage to a PTV.
Something like:
    My_variable:
(:html:)<script>document.getElementById("my_variable").innerHTML =
localStorage.getItem("my_variable");</script><span
id="my_variable"></span>(:htmlend:)

does not work, and I cannot imagine how to.

Yet, Local Storage is so interesting (often a better alternative to
cookies) that I strive to find a way.

Thanks!

Luigi

----
[1] https://en.wikipedia.org/wiki/Web_storage#Local_and_session_storage



More information about the pmwiki-users mailing list