It's really frustrating because i forgot to save in my favourites a video tutorial to do exactly this. I want to capture all attempts to navigate away from the page (via an anchor i.e. <a href="otherpage.html">), and only navigate them depending on some condition (which is only if they don't have unsaved changes on that page).
I remember the example i saw involved getting all the anchors on the page, and then overriding the "open" function? Would that make sense? Does an anchor have an "open" function, or just an onclick function??
The overridden function then performs the check, and returns true or false depending on whether or not the page should be allowed to navigate. Can anyone refresh me on how i would do this? .. or does any one have any other similar solutions?