My cookie is working fine i m not mentioning date so when the browser window is closed the cookie is deleted.
but when i close a tab in a browser window the cookie is not deleted and open the same preserved cookie state page when i open the website
How to delete a cookie when a user closes a Browser tab ?
Below is my code
$(document).ready(function(){
var href = $.cookie("activeElementHref");
if(href!==null)
{
setContainerHtml(href);
};
$('nav ul li a').click(function(e){
e.preventDefault();
href= $(this).attr('href');
$.cookie("activeElementHref", href)
setContainerHtml(href);
});
});
$(window).unload(function() {
$.cookies("activeElementHref",null);
});
function setContainerHtml(href) {
$.ajax({
type: "POST",
url: "baker.php",
data:{send_txt: href},
success: function(data){
$('#aside-right, #intro').css('display','none');
$('#main-content').fadeOut('10', function (){
$('#main-content').css('width','700px');
$('#main-content').css('margin','-30px 0 0 100px');
$('#main-content').html(data);
$('#main-content').fadeIn('8000');
});
}
});
}