I'm tying in to the onbeforeunload
event in Javascript to disable control of the page during the unload process. We have a bunch of users who were editing data during this time and it was wreaking havoc on the product.
There are a bunch of links that show up on the page that have href="javascript:....."
.
Clicking these links fires the disabling code, which makes the page impossible to use. Is there a way I can detect if the onbeforeunload
event is navigating to a different page or just firing this Javascript?
This isn't the most reliable way of checking for this but it works for my purposes:
$('*:focus').attr('href')