Possible to detect if course launched via SCORM?

I have a Storyline course that is sometimes launched simply from a URL, but may also be launched from our LMS via SCORM. If it is not launched from the LMS I want to add a warning that the results will not be recorded.

So my question is:

Is there a way to create a trigger that is based on whether the course was launched via SCORM or not?

4 Replies
Steve Flowers

Hey Will!

I've done this before. The way I tackled it was by creating a variable then running a JavaScript trigger to look at the SCORM username variable. If the SCORM username variable was undefined, I updated this variable to tell the Story to show the notification. Will see if I can find that example.

Steve Flowers

Hey Will -

Here's an example. Worked it a little differently than previously described. Works pretty well.

http://www.xpconcept.com/detectLMS2/story.html

var lmsAPI = parent;

var player=GetPlayer();

if (typeof lmsAPI.GetStudentName == 'function') {

player.SetVar("inLMS","Yes");

}else{

player.SetVar("inLMS","No");

}

Steve

Will Findlay

This is wonderful Steve! Thanks for sharing this. This will be soooo helpful as we sometimes have people who need content tracked while other people do not. And that is really elegant how you have tested for it by seeing if the function was present.

One thing that you got me thinking about was including the student's name. Our LMS names are stored in all caps. I found a function that makes text format as title case. So using this (and stealing some code from another thread which I cannot find right now), I came up with this:

function toTitleCase(str)
{
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}

var player = GetPlayer();

if (typeof lmsAPI.GetStudentName == 'function') {

player.SetVar("inLMS","Yes");

var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = toTitleCase(array[1] + ' ' + array[0]);
player.SetVar("newName", newName);

}else{

player.SetVar("inLMS","No");

}

Then if you insert a reference to newName, you can show the person's name in title case (instead of CAPITALS).