Forum Discussion

WMS's avatar
WMS
Community Member
2 months ago

Getting localstorage key?

Is it possible to access the localStorage key used by a Storyline project when it's published to the web?

On the last slide, I want to clear the localStorage for that lesson so that the next student using the same device isn't prompted to resume the course.

Additionally, is it possible to use that key within the slides? For example, if I create my own localStorage key and it matches a variable, the lesson would continue from where it left off. Otherwise, it would start from the beginning.

  •  

    As far as I know there is no way to get this key with Javascript, not even via the undocumented DS interface

     

    therefore you have to insert the key into the course manually or through a small (python) script

     

    extract the "resume key" from "html5/data/js/data.js"

    search for 

    • "resume":{"id":"

     

     

    add one line to "story.html"

    now you can use

    window.localStorageKey

    to access the localStorage with your JavaScript

    IMPORTANT: On every publish a new key is generated, so you have to redo all steps

     

  •  

    As far as I know there is no way to get this key with Javascript, not even via the undocumented DS interface

     

    therefore you have to insert the key into the course manually or through a small (python) script

     

    extract the "resume key" from "html5/data/js/data.js"

    search for 

    • "resume":{"id":"

     

     

    add one line to "story.html"

    now you can use

    window.localStorageKey

    to access the localStorage with your JavaScript

    IMPORTANT: On every publish a new key is generated, so you have to redo all steps

     

    • WMS's avatar
      WMS
      Community Member

      Thank you! I figured out where the key is on my own but I didn't know that you can just add that to story.html.