Adobe Connect User Community
Menu

#1 2011-05-27 09:52:57

**_mkotsmit_**

Closing Window on the completion of the course

I am publishing a Presenter course to SCORM 4.0 and am wondering what the best way of having the program close the window once the participants get to the end of the course.  Currently the course just ends and they need to close the browser window.

Offline

#2 2011-05-31 04:46:42

**_redhatperl_**

Re: Closing Window on the completion of the course

I guess to may need to create a button on Flash with AS2 and load it in Presenter slides.

Offline

#3 2011-05-31 19:37:31

**_AChemey_**

Re: Closing Window on the completion of the course

mkotsmit,

You can try this...

Check out the article I wrote on "Building Certificates for Presenter/Captivate" found here:  http://www.connectusers.com/tutorials/2 … tificates/  (Look for the link on "Certificates in Flash for Quitting").  This method is preferable for up to Presenter 7.0.6 because it ties in to the Presenter/Captivate LMS queue so that it waits for all LMS calls to complete before attempting to quit/close the browser

You can also create your own AS2-based button that calls JS when clicked (or when on the last page of your Presenter file).  You could insert the JS (preferably in the Template file so it is used every time you publish) that looks like this:

// AEC: Custom Reporting properties - BEGIN
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isIE6 = parseFloat(navigator.appVersion.split('MSIE')[1]) <= 6;
var redirectURL_str = '';    // If the closeBrowser method is called and it's in a browser that doesn't support programatically closing - give a URL to redirect to.
var redirectWait_int = 1.5;    // Number of seconds to wait before attempting to redirect the browser
// AEC: Custom Reporting properties - END

// AEC: Custom Reporting methods - BEGIN
function getDocumentTitle()
{
    return window.document.title;
}

function getStudentName()
{
    var name_str = '';
    if ((isAPI()) && (g_bFinishDone == false))
    {
        if(g_zAPIVersion=="0.2")
        {
            name_str = g_objAPI.LMSGetValue("cmi.core.student_name");
        } else {
            name_str = g_objAPI.GetValue("cmi.learner_name");
        }
    }
    return name_str;
}

function getStudentID()
{
    var ID_str = '';
    if ((isAPI()) && (g_bFinishDone == false))
    {
        if(g_zAPIVersion=="0.2")
        {
            ID_str = g_objAPI.LMSGetValue("cmi.core.student_id");
        } else {
            ID_str = g_objAPI.GetValue("cmi.learner_id");
        }
    }
    return ID_str;
}

function findParentWindow(varWindow)
{
    while(varWindow.parent != varWindow)
    {
        varWindow = varWindow.parent;
    }
    return varWindow;
}

function setExitURL(url_str, waitLimit_int)
{
    if(typeof(url_str) != 'undefined')
    {
        redirectURL_str = url_str;
    }
    if(typeof(waitLimit_int) != 'undefined')
    {
        redirectWait_int = waitLimit_int;
    }
}

function closeBrowser()
{
    var window_obj = findParentWindow(window);
    if(isIE)
    {
        if(isIE6)
        {
            window_obj.opener = top;
            window_obj.close();
        } else {
            window_obj.open('','_parent','');
            window_obj.close();
        }
    } else {
        // this is the only mechanism that *may* work for non-IE browsers
        window_obj.open('','_parent','');
        window_obj.close();
    }
    setTimeout('redirectWin()',redirectWait_int * 1000);

    // Alternatives
    /*
    lstWindow = [window, window.parent, window.opener, window.top];
    for(var objItem in lstWindow)
    {
        var varWindowCurrent = findParentWindow(lstWindow[objItem])
        // Original
        // varWindowCurrent.opener = top;
        // varWindowCurrent.close();

        // Alternative
        // varWindowCurrent.parent.open('','_parent','');
        // varWindowCurrent.parent.close();

        varWindowCurrent.opener = top;
        varWindowCurrent.close();
    }
    */
}

function redirectWin(url_str, window_obj)
{
    if(typeof(url_str) == 'undefined')
    {
        url_str = redirectURL_str;
    }
    if(typeof(window_obj) == 'undefined')
    {
        window_obj = window;
    }
    if(url_str != '')
    {
        window_obj.location.href = url_str;
    }
}
// AEC: Custom Reporting methods - END


Regards,

Andrew

Offline

Board footer