Forum Discussion
lmsAPI Functionality in HTML5 Output
For #1 and #2, I originally thought the same thing. For example, you should just be able to call lmsAPI.GetStudentID()
to get the Student ID. However, this wasn't working when launching from HTML5 for some reason.
After lots of testing and guessing, I found a solution. Turns out the reason why it wasn't working was because lmsAPI wasn't actually set up as a variable like it is when you use the Flash version. (Still not sure why this is, honestly.) But, you can use the following line to get the same functionality from lmsAPI, providedyou are actually launching from an LMS:
var lmsAPI = parent;
I actually ended up creating a function for myself to use, to error-check a little bit:
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);
}
function someOtherFunc(){
var lmsAPI = findLMSAPI(this);
if(lmsAPI != null){
//do stuff
}
}
- SteveG7 years agoCommunity Member
Just found this post and it helped me solve an issue I was having after stripping the Flash from a Storyline 2 published course.
Many thanks