Javascript alerts caused by displaying scorm in iframe?

oschuit3968
Community Member Posts: 3
I've got a curious problem. If I play a scorm package authored with Lectora Online for the first time inside Moodle, the scorm throws a bunch of javascript alerts (see attached image).
I have embedded the scorm player in an iframe, so I suspect this is the culprit. The exact same scorm package works fine in the regular contexts (either the Moodle scorm activity setting "current window" - without any further iframes - or "new window"). The only difference is that in my Moodle installation I am displaying all Moodle activities in a colorbox popup (so, inside an iframe). I've adapted the Moodle Grid course format to achieve this (I'm a full time Moodle plugin developer).
So my question is: what should I do to solve or circumvent this problem? Should I hack the scorm package's javascript? Looking at the scorm's javascript (so, Trivantis' code), I'd say there's something going wrong in the p.save function, maybe getTitleMgrHandle doesn't return the right handle?
I have embedded the scorm player in an iframe, so I suspect this is the culprit. The exact same scorm package works fine in the regular contexts (either the Moodle scorm activity setting "current window" - without any further iframes - or "new window"). The only difference is that in my Moodle installation I am displaying all Moodle activities in a colorbox popup (so, inside an iframe). I've adapted the Moodle Grid course format to achieve this (I'm a full time Moodle plugin developer).
So my question is: what should I do to solve or circumvent this problem? Should I hack the scorm package's javascript? Looking at the scorm's javascript (so, Trivantis' code), I'd say there's something going wrong in the p.save function, maybe getTitleMgrHandle doesn't return the right handle?
Comments
-
Actually, I think the scorm api is still in the same place: the entire Moodle scorm activity page is placed inside an iframe. There's no extra layer (i.e. iframe) between the scorm content and the scorm player.
It's just that "above" this iframe there's another document. If Lectora's javascript makes the assumption that "the API is one step above my current place", then there shouldn't be any problem. However, if they start looking for the API in the top window, then they won't find it there. Could that be what's going on here? -
Turns out that trivantis-cookie.js is the culprit. I have added a crude fix by looking for "parent.parent.parent.titlemgrframe":
function getTitleMgr(A,
Warning: this works in my situation, but if you add yet another nested iframe, you're going to have to adjust the code.{
if (!A) {
return null;
}
if (A.jTitleManager) {
return A.jTitleManager;
} else if (A.document.titleMgr) {
return A.document.titleMgr;
} else {
var C;
<span style="color: #0000ff;">if (parent.parent.parent) {
C = eval("parent.parent.parent.titlemgrframe");
}</span> else if (this.frameElement && this.frameElement.id && this.frameElement.id.indexOf('DLG_content') == 0 && parent.parent) {
C = eval("parent.parent.titlemgrframe");
} else {
C = eval("parent.titlemgrframe");
}
try {
if (!C) C = A.parent.titlemgrframe;
} catch (e) {};
if (C) {
if (C.jTitleManager) return C.jTitleManager;
else return C.document.TitleMgr;
} else {
if (A.name.indexOf('Trivantis_Dlg_') == 0) return getTitleMgr(A.parent, B + 1);
else {
if (A.name.indexOf('Trivantis_') == 0) return getTitleMgr(A.opener, B + 1);
else if (B < 2) return getTitleMgr(A.parent, B + 1);
}
}
};
return null;
};
Categories
- 35.9K All Categories
- 109 ✫ Announcements
- 33.1K Lectora®
- 31.1K Lectora Discussions
- 29K Lectora Desktop
- 2K Lectora Online
- 2K Lectora Feature Requests
- 71 Lectora User Groups
- 36 Lectora Accessibility User Group (LAUG)
- 25 ELB Learning Content
- 25 ELB Learning Content Discussions
- 328 CenarioVR®
- 195 CenarioVR Discussions
- 133 CenarioVR Feature Requests
- 42 Rockstar Learning Platform®
- 39 Rockstar Learning Platform Discussions
- 108 CourseMill®
- 108 CourseMill Discussions
- 47 ReviewLink®
- 47 ReviewLink Discussions
- 7 The Training Arcade®
- 7 The Training Arcade Discussions
- 936 All Things eLearning
- 37 eLearning Development
- 546 Learning Management System (LMS) Integration
- 333 Web Accessibility
- 1.2K ♪ The Green Room
- 9 Additional Learning Products