javacript coding - browser close

I'm looking for javascript coding that displays a warning to the user if they use the x (browser close) to close a course instead of using the course exit button. I need to give a warning to users to use the course exit button so their progress is updated in the LMS. Thanks!

Discussions have been disabled for this post