Is there a way for Javascript (in Firefox) to detect that the user has exited the browser or tab? To be more specific, exiting by clicking the red "X" in the upper right corner?
I'm aware of the window event 'onbeforeunload', but my situation is a bit more complicated. I have a webpage that displays an embedded pdf. This pdf has several actions that submit its form to the server. So, if I use 'onbeforeunload', any submission through the pdf will trigger this function. I wish to avoid that scenario.
What I'm trying to accomplish is prompting the user with a "You haven't saved your changes" message if they try to leave the page. The pdf has a submit button for "Save" so I do not wish to prompt the user with the previously stated message.
I've been googling left and right and the closest I've come to a solution is
here. This didn't work for me. The code specifically mentions microsoft in the comments so I have to assume it's designed for IE.