I want to delete all the cookies if my page is navigating to other page or closing, else I want to let the page refresh normally. The reason behind to do so is Clearing cookie for tabs.
So my Question is:
How will we be able to know that either the page is refreshing or navigating or closing?
I tried using
window.onbeforeunload = function() {
var old_url= window.location.href;
var new_url= /* I dont know how to get new URL here */;
if(old_url == new_url){
return true;
}
else {
return false;
}
}
Its not working :(
Is there any other way to do it?