I am using window.onbeforeunload method to show confirm message if user leaves website.
window.onbeforeunload = function(e) {
return textMsg;
};
But I need this to be fired only if user navigates to external web-site or closes window.
So how to cancel this confirm message for all XHR inside same domain and form submit etc?