Javascript not writing cookies

I want to pass some information in my Storyline course back to an application.  Seems this is simply done by writing a cookie, then jumping to the url and having my program read the cookie.

Problem is my cookies are not getting written.  Any suggestions on how to write a cookie using JavaScript in Articulate Storyline?

My first trigger on the slide is:

When timeline starts execute JavaScript

JavaScript code is:

var player = GetPlayer();
var Scorepoints = player.GetVar("Resuts.scorepoints");
document.cookie = "scorepoints" + "=" + scorepoints + "; "
document.cookie="testcookie=John Doe";

Neither cookie is written.

3 Replies
Ramon Smitherman

That is great info on the player variables.  I was able to set the results.scorepoints to my own variable and then display it in a pop-up.  My only issue now is getting a cookie written.

For testing I am writing a generic cookie statement with no variables.  When I run a program which lists all cookies in my browser it is never there.  This is what is in my Storyline trigger:

var player = GetPlayer();
var Passpercent = player.GetVar("passpercent");
var Scorepercent = player.GetVar("scorepercent");
alert("Your new score is "  + Scorepercent);

Is there a special way we need to write a cookie in storyline?  This seems pretty straight forward.

I should have a cookie named "Mycookie" with a value of "Ramon".  No cookie.