$(window).on('beforeunload', function(e) {
return "You will now be logged out,";
});
$(window).on('unload', function(e) {
document.cookie = 'hodan_current_cookie=; expires=Fri, 3 Aug 2012 20:47:11 UTC; path=/'
});
$("a.outside,button.outside").click(function() {
window.dontclear = true;
});
$(window).on('unload', function(e) {
if(window.dontclear) return; // don't clear
// else clear :
document.cookie = 'hodan_current_cookie=; expires=Fri, 3 Aug 2012 20:47:11 UTC; path=/'
});
var hcc = $('#hodan_current_cookie').val();
document.cookie = 'hodan_current_cookie='+hcc+';UTC; path=/'
var hcc = $('#hodan_current_cookie').val();
document.cookie = 'hodan_current_cookie='+hcc+';path=/'
document.cookie = 'hodan_current_cookie='+hcc+';path=/'
$.cookie('hodan_current_cookie',$('#hodan_current_cookie').val(),{path:'/'});
remove$.removeCookie('hodan_current_cookie');
queryvar ck=$.cookie('hodan_current_cookie');
var hcc = $('#hodan_current_cookie').val();
document.cookie = 'hodan_current_cookie='+hcc+'; expires=Thu, 21 Aug 2014 11:58:20 UTC; path=/'
$.cookie('hodan_current_cookie',$('#hodan_current_cookie').val(),{path:'/'});
$.cookie('hodan_current_cookie',$('#hodan_current_cookie').val(),{path:'/'});
I am looking for a javaScript or jQuery function that will know when the browser is closing...As I understand it, you want to have the cookie disappear when the browser is closed, but you have added the stipulation that the browser might have been directed to another "page" before closing. This strikes me as counter-intuitive and possibly unworkable. Here is my thinking.
from a high-level non-technical viewpointI get the technical details about cookies and all of that. What I want to learn is why? What is the business reason that you want this?
Open in new window