The problem is as follows.
Onbeforeunload works like a charm in Firefox and has e.explicitOriginalTarget.activeElement that shows what element has been clicked to cause it.
window.onbeforeunload = function(e){
if (e.explicitOriginalTarget.activeElement){
return;
}
In Chrome the 'e' object looks identical when you close the window or click the link. Is there any way to determine the target in chrome?