How to access JavaScript href event that triggered beforeunload
问题 I would like to access the event that caused a beforeunload event. Specifically, if I click on a link to another page, I would like to know what the link was in the beforeunload event handler. In this way, I would be perform different actions in the beforeunload event handler according to what the URL was. Eg 'http:' or 'https:' warn user about losing unsaved changes; 'mailto:' or 'skype:' don't warn user because page is not actually going to be unloaded. I am trying to build a good solution