Using JavaScript in Triggers to create a Cookie

I have been able to work with JavaScript pretty effectively in Storyline but have discovered some nuances.

  1. You can not access directly the results variable on the Quiz Results page.  The work around is to create a trigger which copies the results.scorepoints value to a variable you have created.  Then access your variable with JavaScript.
  2. Creating a cookie from JavaScript to be able to pass variable information to a web application does not seem to work.  Use generic JavaScript such as
           document.cookie="testcookie=John Doe";      does not create a cookie
  3. Ask Articulate support about the issue and they tell you they don't provide support for coding JavaScript.

My thought is the issue is related to something in the way Storyline is handling the JavaScript interface.  Much like not being able to access storyline variables directly.   Has anyone been able to figure this out?

2 Replies
Jackson Hamner

Have you tried creating the code for the cookie in the actual story.html file?

From my (very limited) understanding of how javascript and articulate interact we are sort of limited in affecting the actual document page.

I THINK you can get around this by directly editing the story.html file, but that means you will need to add those lines of code into the file each time you publish.

An alternative maybe is to have a separate page open the cookie script? Doing something like



newWin.document.cookie="testcookie=John Doe"


 I've never tried either of these things, and I honestly haven't worked with cookies that much, so I apologize if this doesn't really help. Let me know if you come up with a solution!