My problem is, when user clicks the close browser/current-tab some cookies need to be deleted.
using jquery, onbeforeunloadfired and showing Leave this page and Stay on this page.
How to get which button clicked by user?
how to delete the cookie?
My problem is, when user clicks the close browser/current-tab some cookies need to be deleted.
using jquery, onbeforeunloadfired and showing Leave this page and Stay on this page.
How to get which button clicked by user?
how to delete the cookie?
If it return a string, it's "true".
The question has already been answered here :
$(window).on('beforeunload', function(e) {
return 'Are you sure you want to leave?';
});
$(window).unload(function(){
// do something..
});
Maybe sessionStorage you can help? The sessionStorage object is equal to the localStorage object, except that it stores the data for only one session. The data is deleted when the user closes the browser window. http://www.w3schools.com/html/html5_webstorage.asp