Using javascript?

May 28, 2014

Hi all,

I don't seem to have any luck with javascript. I discovered the below example that was posted on one of the threads to send an email, however I've published the story and it doesn't seem to work. I access the assessment via the story.html file.

This is the code:

//create a player object

var player=GetPlayer();

var userEmail=GetVar(“emailFromStoryline”);

var userScore=GetVar(“scoreFromStoryline”);

//construct the link

var link= userEmail

    +"&subject=" + encodeURI

 ("Course Completion!")

    +"&body=" + encodeURI

 ("Congratulations! Your score for thiscourse is"+ userScore +".");

window.location.href= link;

So, I admit I don't know javascript but no matter what code I use nothing happens.

I used Execute Javascript trigger when the timeline starts, and nothing happens.

Any thoughts? Am I missing a step?

Thanks!

1 Reply
Ashley Terwilliger-Pollard

Hi Jason,

I also don't know Javascript - but you may want to look into where you're testing and hosting the course to see if that is causing issues with your Javascript. You could always try to load it to one of the web server options mentioned in this article or if preparing it for an LMS place it within SCORM Cloud. 

Also, I suspect you've already read through these - but just in case you haven't, here are some Javascript best practices. 

This discussion is closed. You can start a new discussion or contact Articulate Support.