Workaround for the non-working Exit button (as defined in Lectora) for Edge or Chrome browsers?

timsantoro
timsantoro Community Member Posts: 1 ☆ Roadie ☆
Anyone know of a workaround for the non-working Exit button (as defined in Lectora) for Edge or Chrome browsers? Our LMS opens the course in a new window, therefore the Javascript to close the course window will not work due to the new security built into Chrome and Edge. Since the course window was not opened using Javascript, the close function is deemed malicious. Thanks in advance for any solutions that you can help define here.
Tagged:

Answers

  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 574 eLearning ROCKSTAR Admin Team
    What I have seen some customers do in the past is to run another action after the exit action and show an initially hidden text block with a background that covers the screen.

    The text block would have some text like this: "Your progress has been saved and it is safe to close this browser window."
  • carlfink
    carlfink Community Member Posts: 943 ♦ Idol ♦
    What @wheels suggests is exactly what we do, again precisely because the Exit button does not work reliably or on every platform.
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    Hi @timsantoro What we have done for several years now is replace the Lectora scofunctions2004 file that is created when the course is published in scorm with a customized copy. I will need to see if it is okay to share the file.
  • vicki
    vicki Community Member Posts: 75 ♪ Opening Act ♪
    From my LMS manager regarding the scofunctions2004 customization. I don't understand most of what she said, but the fix works in Moodle:

    To close the window, we are really just changing one function.

    function doQuit(bForce){
    computeTime();
    saveVariable( 'TrivantisEPS', 'T' );

    //LMSSetValue( 'adl.nav.request', 'exit' ;
    var result;
    result = LMSCommit();
    finishCalled = true;
    result = LMSFinish();
    saveVariable( 'TrivantisSCORMTimer', 0 );
    //if( bForce && window.myTop ) window.myTop.close()
    window.myTop.close();

    }

    As to the adl.nav.request, that may not matter to others. Since we don’t have multiple scos in a single scorm, this has caused issues in the past, so we just comment it out to prevent any errors.

    The main thing is the commenting out the “if (bForce….” line and just always calling the window.myTop.close(). I still don’t know what that “bForce” variable is, but it never seems to be passed into the function and the window won’t close without it. So, we ditch the if statement and just close the window anyways.
  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 574 eLearning ROCKSTAR Admin Team
    The bForce variable is set to true when you publish with the publish option The published course will be presented in a separate window than the LMS is checked. We are planning to remove that publish option and always default it. We should always "try" to close the window, the browser will not let us if it's in the same window as the LMS anyway.
  • web-foley
    web-foley Community Member Posts: 55 ✶ Headliner ✶
    edited May 20, 2021
    We were unable to use (anymore) the "initially hidden text block with a background that covers the screen" as it didn't meet Accessibility standards (it's not a proper modal dialog, they can be tricky as they're a bugger to control focus, I've never been able to make one with Lectora yet https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html). I believe our LMS has an open window waiting for our course window to close.
  • carlfink
    carlfink Community Member Posts: 943 ♦ Idol ♦
    web-foley said:

    ... it's not a proper modal dialog, they can be tricky as they're a bugger to control focus, I've never been able to make one with Lectora yet ...

    I know little about Aria, but in Lectora courses that needed a real dialog, I have always ended up having to work around Lectora itself and just write simple JavaScript code to open a system dialog. It's one of the very easiest things to do in JS--I'm far from skilled in that language. If you needed something like support for multiple language, of course, it would get significantly harder.
  • davidcm
    davidcm Community Member Posts: 20 ♪ Opening Act ♪
    I just ran into this issue with a course published to AICC and launched in Chrome. Any new ideas on how to fix it?
  • wheels
    wheels Florida USACommunity Member, Administrator, Moderator, Rockstar Manager Posts: 574 eLearning ROCKSTAR Admin Team
    @davidcm it looks like to topic of this thread mutated. What issue, exactly, did you run into? If it is that the Lectora close button is not closing the browser here are the two solutions:

    When you publish your course, make sure the publish option The published course will be presented in a separate window than the LMS is checked.

    ... then if it is still not working ...

    What I have seen some customers do in the past is to run another action after the exit action and show an initially hidden text block with a background that covers the screen.

    The text block would have some text like this: "Your progress has been saved and it is safe to close this browser window."




  • davidcm
    davidcm Community Member Posts: 20 ♪ Opening Act ♪
    Thanks for the quick response, @wheels. I published a course to AICC and the Exit button (on mouse click exit/close) didn't close the main course window in Chrome, although it did work in Firefox. The same button that was inherited in sub-windows (Help window and Glossary window) did work.

    Unfortunately, the first option - launching the course in a separate window - didn't solve the problem.

    With regards to the second option, is it possible to navigate to the window close button entirely by keyboard?

  • davidcm
    davidcm Community Member Posts: 20 ♪ Opening Act ♪
    @wheels This may work: users can use a keyboard shortcut for Chrome and Edge to close the tab or window. The instructions on how to do this can be added to the block of text. No accessibility issues.

    Thanks for your help.

    Best, David
  • carlfink
    carlfink Community Member Posts: 943 ♦ Idol ♦
    @davidcm, Lectora buttons are using the JavaScript engine in the browser "under the hood". JavaScript cannot close the main browser window, as a security measure. It can only close windows that were opened with JavaScript. That means that a course launched in a separate window can close itself, but not the main browser window. If a course is not launched in its own window, it just cannot close itself.
  • davidcm
    davidcm Community Member Posts: 20 ♪ Opening Act ♪
    @carlfink Thanks for your note. The most recent version of Lectora 19 has fixed the issue.