MDL-40702 SCORM: - use iframe instead of object - iframe is supported better.

This commit is contained in:
Dan Marsden 2013-07-17 14:30:22 +12:00
parent 07bbbcf174
commit 57f32aa32e
2 changed files with 13 additions and 39 deletions

View File

@ -100,41 +100,20 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc
}
var content = new Y.YUI2.util.Element('scorm_content');
try {
// first try IE way - it can not set name attribute later
// and also it has some restrictions on DOM access from object tag
if (window_name || node.title == null) {
var obj = document.createElement('<iframe id="scorm_object" src="">');
if (window_name) {
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(! mine) {
alert(M.str.scorm.popupsblocked);
}
mine.close()
}
}
else {
var obj = document.createElement('<iframe id="scorm_object" src="'+url_prefix + node.title+'">');
}
// fudge IE7 to redraw the screen
if (Y.YUI2.env.ua.ie > 5 && Y.YUI2.env.ua.ie < 8) {
obj.attachEvent("onload", scorm_resize_parent);
}
} catch (e) {
var obj = document.createElement('object');
obj.setAttribute('id', 'scorm_object');
obj.setAttribute('type', 'text/html');
if (!window_name && node.title != null) {
obj.setAttribute('data', url_prefix + node.title);
}
if (window_name) {
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(! mine) {
alert(M.str.scorm.popupsblocked);
}
mine.close()
}
var obj = document.createElement('iframe');
obj.setAttribute('id', 'scorm_object');
obj.setAttribute('type', 'text/html');
if (!window_name && node.title != null) {
obj.setAttribute('src', url_prefix + node.title);
}
if (window_name) {
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(! mine) {
alert(M.str.scorm.popupsblocked);
}
mine.close()
}
var old = Y.YUI2.util.Dom.get('scorm_object');
if (old) {
if(window_name) {

View File

@ -259,12 +259,7 @@ if ($result->prerequisites) {
$scorm->width, $scorm->height)));
?>
<noscript>
<!--[if IE]>
<iframe id="main" class="scoframe" name="main" src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr; ?>"></iframe>
<![endif]-->
<!--[if !IE]>
<object id="main" class="scoframe" type="text/html" data="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr; ?>"></object>
<![endif]-->
</noscript>
<?php
}