HTML5 & localstorage

Has anyone experimented with the use of Javascript localstorage with Storyline?

I would like to be able to use something like this to store user notes while going through a Storyline course, then print out a Notes document at the end. I thought perhaps localstorage might be the ticket.

I believe it will work when the Storyline course is in a browser, but what might happen when the course is being viewed in the Articulate player  Android and iPad? Would I lose this ability, since it is not rendering in a browser?

6 Replies
Mark Ramsey

I was hoping to have the ability to let them have multiple sessions for storing as many notes as they can, for as many slides as necessary. I was hoping that using localstorage would allow me to keep notes between sessions cumulatively, then print them out whenever, without using any middleware or external database.

Mark Ramsey

At this point I'm thinking we might have to forego the persistent data part. I'm concentrating more right now on somehow posting data to a web page that could render the data in a browser. I would still have to dip down into Javascript, unless I could somehow hot--rod the Quiz Print Results trigger in some way. Also, if I use a conventional post, I would have to encode the post in some way (Javascript). I have not used JSON to any great extent. Would this be any better for my purposes?

Carlos Amadeo

There is a bug on Storyline 2 regarding parameter passing on the URL.  If the target device is an iOS device and your original link points to the story.html file it will be redirected to story_html5 without the original parameters, so you won't be able to use them.  There's a hack though, if you modify line 99 of story.html and change from location.replace(strLocation) with location.replace( then the parameters will be passed along to the HTML5 file.

However, this has become such a pain that I've been looking for an alternative option and I've tested using localStorage for saving information.  The good news that it does work, like a charm!  You're able to use localStorage.setItem and localStorage.getItem to save your key pair data.


Math Notermans

Following this  mainly because im researching how to globally setup variables and loading JS once...not on every slide... Noticed that using a setup like this does work...

window.myVar = "set on slide 1";
console.log("global slide 1: "+window.myVar);

And on a next slide...
window.myVar = "changed on slide 2";

Now on all slides... your vars stay set...
Leaving and closing the project however the values are lost, so at some point they need to be set into either sessionstorage , Storyline/LMS variables or some other saved data online...