Skip to main content
June 18, 2009
Question

Prompt user before exiting

  • June 18, 2009
  • 1 reply
  • 516 views

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();
}
}
}

    This topic has been closed for replies.

    1 reply

    Captiv8r
    Legend
    June 18, 2009

    Hi there

    Because closing the window using JavaScript is so utterly unreliable and simply doesn't work in all cases...

    I'd do it like this.

    Insert a slide at the end of the movie.

    Time that slide very brief. Perhaps .1 seconds.

    Configure the movie to close when it completes play. (Edit > Preferences > Project > Start and End)

    Insert two buttons on the slide before the last slide. One will be labeled Yes and one will be labeled No.

    Insert a Text Caption on the slide asking the user if they wish to exit.

    Program the Yes button to Go to the Next Slide. Program the No button to visit a different slide.

    Insert buttons on other slides that are labeled Exit and are configured to jump to the slide where the user chooses.

    Cheers... Rick