javascript failing on ipad

Sep 15, 2017

The following javascript, in a trigger, successfully sends a score and status of complete to my LMS in Windows and Mac OS browsers:

var player = GetPlayer();
var lmsAPI = parent;
var scorePercentage = player.GetVar("LMS_L03_Score");
var scorePassPercentage = 100; //player.GetVar(Totalscore);
lmsAPI.SetScore(scorePercentage, 100, 0);

if (lmsAPI.SCORM2004_TRUE) {
} else {

However, when I get to the place in the course where this javascript is triggered, on an iPad in Safari, neither the score nor completion status are sent to my LMS.

No, I am not using AMP, this is being rendered as HTML5 in Safari browser. I tried it on several iPads.  I know Articulate doesn't support javascript coding but I would appreciate anyone's insight on why this particular javascript trigger isn't working on iPad while the other javascript on the same page (completely different) is working just fine.  Both javascript triggers happen when a button is clicked. The first javascript trigger is failing, the 2nd javascript trigger succeeds.  Again, both javascript triggers work fine when executed from Windows or Mac OS browsers.


2 Replies
David Kelling

After much ado, we figured out. Our conclusions, not necessarily accurate:

We removed this line: "var lmsAPI = parent;" because it seems the iPad already knew where the lmsAPI was and doing this messed it up.

We also figured out that even though we were publishing SCORM 2004 we did not need to do lmsAPI.SCORM2004_TRUE so things work with just "SetStatus("completed");"

We also figured out that things worked fine in but not in our LMS and that things worked fine in our LMS with newer iPads but not older ones.

And I also learned that if an old iPad has a problem with a line of javascript it will stop processing it, not tell you, and therefore never get to your alerts ;-)

In the end the working code looks like this:

var player = GetPlayer();
var scorePercentage = player.GetVar("trad_score_tracker");
lmsAPI.SetScore(scorePercentage, 100, 0);

Hope this provides a hint to someone else someday.


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