Skip to main content
Inspiring
April 6, 2017
Question

Exit button and project end option "exit" not working

  • April 6, 2017
  • 1 reply
  • 419 views

I created several modules and have an issue with the exit button and the exit at end of project option is not working in Firefox and Chrome but works in Explorer.

Any ideas

    This topic has been closed for replies.

    1 reply

    TLCMediaDesign
    Inspiring
    April 6, 2017

    You need to override CP's exit function.

    I use this code for a SCORM 2004 course. This code needs to be loaded after the CPM.js file is loaded to work. If you put this in the head of the html (for HTML5 output only) it will exit correctly. I wrote this to stop the entire browser from closing in the LMS in IE, it's been tested in every browser and tablets.

    var netConnected = location.protocol.indexOf( 'http' );

    var localHost = location.href.indexOf( 'localhost' );

    window.addEventListener( 'moduleReadyEvent', function ( e )

    {

    interfaceObj = e.Data;

    eventEmitterObj = interfaceObj.getEventEmitter();

        initializeEventListeners();

    //override Captivates exit function, fix for IE closing browser

    window.DoCPExit = function()

    {

      if ( netConnected != -1 && localHost == -1 )//only execute if running on the server

      {

       SCORM2004_CallSetValue( 'adl.nav.request', 'suspendAll' );

       SCORM2004_CallSetValue( 'cmi.exit', 'suspend' );

       var result = SCORM2004_CallTerminate();

      

       if ( result )

       {

        document.location.href = 'goodbye.html';

       }

      }

      else

      {

       var win = window.open( '', '_top', '', 'true' );

             win.opener = true;

             win.close();

      }

    }

    });