How to detect SCORM version in javascript within a Storyline 360 course?

Good Day!

I am currently building a project in Storyline 360 and among the requirements were to have a multi-version compatibility among SCORM 1.2, SCORM 2004 and AICC. I have a javascript within my Storyline course which uses the SCORM_GetStudentName() function from the LMS and was published as SCORM 1.2 which worked fine.

For my second test, I've added SCORM2004_GetStudentName() along with my previous code assigned them to a variable and checked for null which I I thought should be working (but didn't) since all of the js files are in the LMS.

My question is: How do I check for the SCORM version within javascript inside my Storyline course. 

So far this is my code but it does not work for every SCORM version. I uploaded my course through SCORM Cloud.

var player = GetPlayer();
var tempS2004 ="";
var tempS1 ="";
var tempA="";
var student="";
var suspendData =SCORM2004_GetDataChunk();

tempS1 = SCORM_GetStudentName();
tempS2004 = SCORM2004_GetStudentName();
tempA = AICC_GetStudentName();


alert(tempS1+" "+tempS2004+" "+tempA);


if(!suspendData){
player.SetVar("userName",student);
}else{
player.SetVar("userName",suspendData);
}

var username= player.GetVar("userName");

AICC_SetDataChunk(username);
SCORM2004_SetDataChunk(username);
SCORM_SetDataChunk(username);

Any help would be very much appreciated.

2 Replies