Copy link to clipboard
Copied
I want to use the multi-SCO packager, or something that provides that same functionality, to break up my courses by lesson so that they load faster. But, at the beginning of the course I've set it up so that the learner can input their name, title, etc. to personalize the course. I am required to post everything on an LMS, so is there any way to set it up so that the variables and/or advanced actions that are setup in the first SCO or accessed and used by the subsequent SCOs without re-creating them in each SCO?
Thanks.
Jay
Copy link to clipboard
Copied
Technically SCO's cannot communicate with each other.
You could use localStorage in the users browser to set and retrieve the variables.
The student name should already be available from the LMS via the CP variable cpQuizInfoStudentName.
I don't have time right now to set up a local storage, but the following example is used in a course where if the user changes the volume settings, it is written to local storage so that the volume is the same across all SCOs. It not set up for CP variables though.
var courseID = "yourCourseID"+".";
function getConnected()
{
if ( window.location.href.indexOf("http") == 0 )
{
return true;
}
else
{
return false;
}
}
//Checks if brower supports localStorage
function supports_html5_storage()
{
if ( typeof(Storage) !== "undefined" )
{
return true;
}
else
{
return false;
}
}
function getVolume()
{
var thisVol = courseID+"myVolume";
if ( supports_html5_storage() )
{
if ( localStorage.getItem(thisVol) == null || localStorage.getItem(thisVol) == 'undefined' )
{
localStorage.setItem(thisVol, 60);
return 60;
}
else
{
return parseInt( localStorage.getItem(thisVol) );
}
}
else
{
alert("Your browser does not support local storage, your volume setting cannot be saved for this module.")
}
}
//function called from the main file when user changes volume settings
function setVolume( vol )
{
if ( supports_html5_storage() )
{
localStorage[courseID+"myVolume"] = vol;
}
}
Copy link to clipboard
Copied
Thanks much for the feedback. I'll have to check with out IT folks, but this might work.
Jay