Prompt user before exiting
Hello,
I'm trying to add Javascript in order to have a prompt appear once a user clicks an Exit button to confirm their choice to exit the CBT. I added a button to Captivate that successfully calls the closeBrWindow() function (see code below); however, I receive an 'Access is Denied' error message once the 'continuebox' function is added. This CBT is running on the Adobe Connect server when I receive the error message.
Can anyone see what I'm doing wrong? Is there a better way to prompt a user when clicking an Exit button?
function closeBrWindow()
{
var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
var continuebox=confirm("Click OK to exit the CBT, or Cancel to return to the CBT.");
if (continuebox==true)
{
if (ie7)
{
//This method is required to close a window without any prompt for IE7
window.open('','_parent','');
top.window.close();
}
else
{
//This method is required to close a window without any prompt for IE6
this.focus();
self.opener = this;
self.close();
}
}
}