Disable 'Changes you made may not be saved' notification from browser

GuillaumeC
GuillaumeC Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 5 ☆ Roadie ☆
Hello.
When exiting a module from a LMS by closing the content window, a 'Changes you made may not be saved' message may appear.
I have read that this can be disabled with a 'window.onbeforeunload = null' command.
Do you know how this can be implemented in a Lectora title ?

Thank you for your help !

Best Answer

Answers

  • wheels
    wheels Community Member, Administrator, Moderator, Rockstar Manager Posts: 685 eLearning ROCKSTAR Admin Team
    edited May 12, 2021
    Can you tell us a little more about your use case? This prompt should help ensure learners close your course properly, with an exit button. This also prevents the learner from accidentally reloading the content (on mobile if they are swiping down to scroll up and scroll to far). There are a lot of different scenarios and it would be great to hear how you host your course. Is it displayed in it's own window, or in the same window within the LMS?

    If you absolutely need to disable it you would have a project level action:
    Project -> On Show -> Run JavaScript

    getDisplayWindow().onbeforeunload = null;
  • GuillaumeC
    GuillaumeC Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 5 ☆ Roadie ☆
    Thank you for your prompt reply.
    I will inform my client of the "risks" involved.
    Can you please confirm that the enclosed picture is the correct way to implement?
    It doesn't seem to work.

  • wheels
    wheels Community Member, Administrator, Moderator, Rockstar Manager Posts: 685 eLearning ROCKSTAR Admin Team
    This is the correct way to disable the prompt:

    If the author does not like the prompt when the student closes the window by either a reload or by clicking the browser window close button, they can add a JS action at the title level that On Show runs this code:

    (window.myTop || window).noPromptOnUnload = true;
  • jchafey
    jchafey Community Member Posts: 1 ☆ Roadie ☆

    We recently moved to Docebo and our Lectora courses would no longer resume correctly.

    Your JS code worked perfectly. Thank you!