Question
Getting parent window to close
Hello. I've imported my captivate file into my LMS, but it
seems to open a parent window. I've inserted the window.close =
function() as suggested, but can't get it to work. Am I putting the
code in the worng place? Where exactly do I put the code?
Here is a copy of my existing code.....
<!-- saved from url=(0013)about:internet -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Section 1 - Basic skills</title>
<script src="standard.js" type="text/javascript"></script>
<script type="text/javascript" language="JavaScript">
var strURLFile = "part 1_skin.swf"; // Name of the flash file
var strExitFile = "exit.swf"; // Name of the flash file that can facilitate LMS termination
var strExitMessage = "Please remember to click the Exit button in the content, before closing the browser window. Press \"OK\" to continue."
var isMSIE = navigator.appName.indexOf("Microsoft") != -1;
var g_bFinishDone = "";
var AICC_URL="";
var AICC_SID="";
var strURLBase = "";
var strURLParams = "";
var varWindow = findAICCwindow(window);
var strURLFull = varWindow.document.location.toString();
var intTemp = strURLFull.indexOf("#");
if (intTemp == -1)
intTemp = strURLFull.indexOf("?");
if (intTemp > 0)
strURLParams = strURLFull.substring(intTemp + 1, strURLFull.length);
var strTemp = location.protocol.toUpperCase();
if (strTemp.indexOf("FILE") == -1)
var intTemp = location.pathname.lastIndexOf("/");
else if (isMSIE)
var intTemp = location.pathname.lastIndexOf("\\");
else
var intTemp = location.pathname.lastIndexOf("/");
if (intTemp != -1)
strURLBase = location.protocol + "//" + location.host + location.pathname.substring(0, intTemp + 1);
else
strURLBase = location.protocol + "//" + location.host + location.pathname;
strURLParams = (strURLParams==unescape(strURLParams)?escape(strURLParams):strURLParams);
strURLParams = (strURLParams==""?"":"?") + strURLParams;
if(strURLParams.length > 1 && strURLParams.charAt(0)=='?')
strTemp = strURLParams.substr(1);
var aryTemp = strTemp.split("&");
for(var intTemp=0;intTemp < aryTemp.length; intTemp++)
{
var strPair = aryTemp[intTemp].split("=");
if(strPair.length==2)
{
var strName=strPair[0].toUpperCase();
if(strName=='AICC_SID')
AICC_SID=strPair[1];
else if (strName=='AICC_URL')
AICC_URL=strPair[1];
}
}
function findAICCwindow(win)
{
// This is a simple mechanism to walk up a frameset tree to find the window with AICC parameters. This
// function should be modified, if the parameters are in a more complicated structure.
if(win.document.location.toString().toUpperCase().indexOf("AICC_URL") == -1)
{
if(win!=window.top)
{
win = (findAICCwindow(win.parent));
}
}
return win;
}
function setFinished(finished_bln)
{
g_bFinishDone = finished_bln;
}
function Finish()
{
// ExitAU
if(g_bFinishDone == false)
{
g_bFinishDone = true;
if (AICC_URL !="")
{
if (isMSIE)
{
window.frames[0].document.forms[0].submit();
var ms = (new Date()).getTime();
while ((new Date()).getTime()-ms < 1000)
window.status="posting to LMS...";
} else {
var w = varWindow.open("","mm_exitAU","top=4000,left=4000,scrollbars=no,directories=no,height=1,width=1,status=no,toolbar=no,menubar=no,location=no");
if (w==null)
{
document.write('<table border="0" cellpadding="7" cellspacing="7"> \n');
document.write(' <tr> \n');
document.write(' <td align="middle">');
writedocument('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1" height="1" align="middle"> \n'+
' <param name=movie value="' + strURLBase + strExitFile + strURLParams + '">\n'+
' <param name=quality value=high> \n'+
' <param name=menu value=false> \n'+
' <param name=loop value=0> \n'+
' <embed src="' + strURLBase + strExitFile + strURLParams + '" pluginspage="https://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" quality=high type="application/x-shockwave-flash" name="Captivate1" width="1" height="1" align="middle" swLiveConnect="true">\n'+
' </embed> \n'+
' </object>');
document.write('</td> \n');
document.write(' </tr> \n');
document.write('</table> \n');
alert(strExitMessage);
} else {
w.document.write("<html><head>"+"<script"+">function findAICCwindow(win){if(win.document.location.toString().toUpperCase().indexOf('AICC_URL') == -1) {if(win!=window.top){win = (findAICCwindow(win.parent));}}return win;}function exitAU() {var varWindow=findAICCwindow(window);window.document.forms[0].submit();varWindow.close();}</"+"script>"+
"</head>"+
"<body>"+
"<form action='"+unescape(AICC_URL)+"' method='post'>"+
"<input type='hidden' name='session_id' value='"+unescape(AICC_SID)+"'>"+
"<input type='hidden' name='version' value='3.5'>"+
"<input type='hidden' name='command' value='ExitAU'>"+
"</form>"+
"</body>"+
"</html>");
w.exitAU();
}
}
}
}
}
function isrc()
{
return '<HTML><head><script><'+'/script></head><body MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0">'+
"<form action='"+unescape(AICC_URL)+"' method='post' name='brz' ><input type='hidden' name='session_id' value='"+unescape(AICC_SID)+"'/><input type='hidden' name='version' value='3.5'/><input type='hidden' name='command' value='ExitAU'/></form>"+
"</body></html>";
}
if (isMSIE) {
document.write('<iframe name="iframe" width="0" height="0" src="javascript:parent.isrc()"></iframe>');
}
</script>
</head>
<body bgcolor="#F5F4F1" onunload="Finish();">
<script type="text/javascript" language="JavaScript" name="cmifrag">
document.write('<center>');
document.write('<table border="0" cellpadding="7" cellspacing="7"> \n');
document.write(' <tr> \n');
document.write(' <td align="middle">');
writeDocument('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="Captivate1" width="800" height="624" align="middle"> \n'+
' <param name=movie value="' + strURLBase + strURLFile + strURLParams + '">\n'+
' <param name=quality value=high> \n'+
' <param name=loop value=2> \n'+
' <embed src="' + strURLBase + strURLFile + strURLParams + '" pluginspage="https://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" quality=high type="application/x-shockwave-flash" name="Captivate1" width="800" height="624" align="middle" swLiveConnect="true">\n'+
' </embed> \n'+
' </object>');
document.write('</td> \n');
document.write(' </tr> \n');
document.write('</table> \n');
document.write('</center>');
</script>
</body>
</html>
Here is a copy of my existing code.....
<!-- saved from url=(0013)about:internet -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Section 1 - Basic skills</title>
<script src="standard.js" type="text/javascript"></script>
<script type="text/javascript" language="JavaScript">
var strURLFile = "part 1_skin.swf"; // Name of the flash file
var strExitFile = "exit.swf"; // Name of the flash file that can facilitate LMS termination
var strExitMessage = "Please remember to click the Exit button in the content, before closing the browser window. Press \"OK\" to continue."
var isMSIE = navigator.appName.indexOf("Microsoft") != -1;
var g_bFinishDone = "";
var AICC_URL="";
var AICC_SID="";
var strURLBase = "";
var strURLParams = "";
var varWindow = findAICCwindow(window);
var strURLFull = varWindow.document.location.toString();
var intTemp = strURLFull.indexOf("#");
if (intTemp == -1)
intTemp = strURLFull.indexOf("?");
if (intTemp > 0)
strURLParams = strURLFull.substring(intTemp + 1, strURLFull.length);
var strTemp = location.protocol.toUpperCase();
if (strTemp.indexOf("FILE") == -1)
var intTemp = location.pathname.lastIndexOf("/");
else if (isMSIE)
var intTemp = location.pathname.lastIndexOf("\\");
else
var intTemp = location.pathname.lastIndexOf("/");
if (intTemp != -1)
strURLBase = location.protocol + "//" + location.host + location.pathname.substring(0, intTemp + 1);
else
strURLBase = location.protocol + "//" + location.host + location.pathname;
strURLParams = (strURLParams==unescape(strURLParams)?escape(strURLParams):strURLParams);
strURLParams = (strURLParams==""?"":"?") + strURLParams;
if(strURLParams.length > 1 && strURLParams.charAt(0)=='?')
strTemp = strURLParams.substr(1);
var aryTemp = strTemp.split("&");
for(var intTemp=0;intTemp < aryTemp.length; intTemp++)
{
var strPair = aryTemp[intTemp].split("=");
if(strPair.length==2)
{
var strName=strPair[0].toUpperCase();
if(strName=='AICC_SID')
AICC_SID=strPair[1];
else if (strName=='AICC_URL')
AICC_URL=strPair[1];
}
}
function findAICCwindow(win)
{
// This is a simple mechanism to walk up a frameset tree to find the window with AICC parameters. This
// function should be modified, if the parameters are in a more complicated structure.
if(win.document.location.toString().toUpperCase().indexOf("AICC_URL") == -1)
{
if(win!=window.top)
{
win = (findAICCwindow(win.parent));
}
}
return win;
}
function setFinished(finished_bln)
{
g_bFinishDone = finished_bln;
}
function Finish()
{
// ExitAU
if(g_bFinishDone == false)
{
g_bFinishDone = true;
if (AICC_URL !="")
{
if (isMSIE)
{
window.frames[0].document.forms[0].submit();
var ms = (new Date()).getTime();
while ((new Date()).getTime()-ms < 1000)
window.status="posting to LMS...";
} else {
var w = varWindow.open("","mm_exitAU","top=4000,left=4000,scrollbars=no,directories=no,height=1,width=1,status=no,toolbar=no,menubar=no,location=no");
if (w==null)
{
document.write('<table border="0" cellpadding="7" cellspacing="7"> \n');
document.write(' <tr> \n');
document.write(' <td align="middle">');
writedocument('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1" height="1" align="middle"> \n'+
' <param name=movie value="' + strURLBase + strExitFile + strURLParams + '">\n'+
' <param name=quality value=high> \n'+
' <param name=menu value=false> \n'+
' <param name=loop value=0> \n'+
' <embed src="' + strURLBase + strExitFile + strURLParams + '" pluginspage="https://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" quality=high type="application/x-shockwave-flash" name="Captivate1" width="1" height="1" align="middle" swLiveConnect="true">\n'+
' </embed> \n'+
' </object>');
document.write('</td> \n');
document.write(' </tr> \n');
document.write('</table> \n');
alert(strExitMessage);
} else {
w.document.write("<html><head>"+"<script"+">function findAICCwindow(win){if(win.document.location.toString().toUpperCase().indexOf('AICC_URL') == -1) {if(win!=window.top){win = (findAICCwindow(win.parent));}}return win;}function exitAU() {var varWindow=findAICCwindow(window);window.document.forms[0].submit();varWindow.close();}</"+"script>"+
"</head>"+
"<body>"+
"<form action='"+unescape(AICC_URL)+"' method='post'>"+
"<input type='hidden' name='session_id' value='"+unescape(AICC_SID)+"'>"+
"<input type='hidden' name='version' value='3.5'>"+
"<input type='hidden' name='command' value='ExitAU'>"+
"</form>"+
"</body>"+
"</html>");
w.exitAU();
}
}
}
}
}
function isrc()
{
return '<HTML><head><script><'+'/script></head><body MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0">'+
"<form action='"+unescape(AICC_URL)+"' method='post' name='brz' ><input type='hidden' name='session_id' value='"+unescape(AICC_SID)+"'/><input type='hidden' name='version' value='3.5'/><input type='hidden' name='command' value='ExitAU'/></form>"+
"</body></html>";
}
if (isMSIE) {
document.write('<iframe name="iframe" width="0" height="0" src="javascript:parent.isrc()"></iframe>');
}
</script>
</head>
<body bgcolor="#F5F4F1" onunload="Finish();">
<script type="text/javascript" language="JavaScript" name="cmifrag">
document.write('<center>');
document.write('<table border="0" cellpadding="7" cellspacing="7"> \n');
document.write(' <tr> \n');
document.write(' <td align="middle">');
writeDocument('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="Captivate1" width="800" height="624" align="middle"> \n'+
' <param name=movie value="' + strURLBase + strURLFile + strURLParams + '">\n'+
' <param name=quality value=high> \n'+
' <param name=loop value=2> \n'+
' <embed src="' + strURLBase + strURLFile + strURLParams + '" pluginspage="https://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" quality=high type="application/x-shockwave-flash" name="Captivate1" width="800" height="624" align="middle" swLiveConnect="true">\n'+
' </embed> \n'+
' </object>');
document.write('</td> \n');
document.write(' </tr> \n');
document.write('</table> \n');
document.write('</center>');
</script>
</body>
</html>