Whenever I add an event listener window.onbeforeunload
, can I check where the page is being redirected to?
Or at least what the developer is trying to change.
The following is the thing that I really want:
This is what I do right now :
$(window).bind("beforeunload",function(){
//I do what I want here
});
Now the issue is, I want to change the logic, when document.location.href = "mailTo:*"
is being called. i.e. I do not want to do anything when doccument.location.href
is called, so I want my logic to me like:
$(window).bind("beforeunload",function(){
if(document.location.href has mailTo:)
{
//do nothing
}
else
{
//my old logic applies here
}
});