Need help reading javascript cookie
Nov 17, 2017
I am using Animate CC as a web object in storyline 360. The Animate CC page sets two cookies. I can get storyline 360 to read my first cookie, which is a number. But I can't get storyline 360 to correctly pull up my second cookie, which is a string... instead it reads, "undefined". Here is the code and a screenshot of the first alert. The second alert when set to [3] comes up undefined:
checklogin();
function checklogin(){
setTimeout(function(){
var numCookie = document.cookie.split('=');
alert(numCookie);
alert(numCookie[1]); // don't know how to get [3]; "undefined"
if(numCookie == null || numCookie == 0){
checklogin(); //to recall the script after it is done
}
else{
var player = GetPlayer();
player.SetVar("cookieValueNum", numCookie[1]);
clearTimeout(time);
}
}, 5000);
}
1 Reply
Why are you using cookies and not just passing it in with a function?
This discussion is closed. You can start a new discussion or contact Articulate Support.