could you add something like this to your html page?
This won't prevent them exiting, which really you should not be able to do, but you could customise the message to say exiting this way may mean you lose your work. Probably a good way to annoy a user though.
window.onbeforeunload = confirmExit; function confirmExit() { return "You have attempted to leave this page. Are you sure?";
Well, I had tried some very similar code, but it wasn't working. I just placed it on the slide master instead of the slide itself, and your code is working. I'm not sure if there was a problem with the sample code I had, or if it was the placement in the course.
This works pretty well. I had to also add the code to my "Save & Exit" page, and tell it NOT to display the message, as it's a little annoying to see when the user actually clicks my Exit Course button. I'm not sure why the code was executing there when I had placed it on another slide (no longer on the slide master).
Also, in Firefox, a default message is displayed instead of the one specified in the js code, which isn't the end of the world.
As it is a function it may display whenever you try to close the browser, which is why it is also working on the save and exit page. Glad it is working at all:-)
4 Replies
could you add something like this to your html page?
This won't prevent them exiting, which really you should not be able to do, but you could customise the message to say exiting this way may mean you lose your work. Probably a good way to annoy a user though.
Well, I had tried some very similar code, but it wasn't working. I just placed it on the slide master instead of the slide itself, and your code is working. I'm not sure if there was a problem with the sample code I had, or if it was the placement in the course.
Thanks very much Phil!
This works pretty well. I had to also add the code to my "Save & Exit" page, and tell it NOT to display the message, as it's a little annoying to see when the user actually clicks my Exit Course button. I'm not sure why the code was executing there when I had placed it on another slide (no longer on the slide master).
Also, in Firefox, a default message is displayed instead of the one specified in the js code, which isn't the end of the world.
As it is a function it may display whenever you try to close the browser, which is why it is also working on the save and exit page. Glad it is working at all:-)
This discussion is closed. You can start a new discussion or contact Articulate Support.