Я создал файл cookie с помощью jQuery. Я хочу удалить файл cookie с помощью jQuery при закрытии браузера. Как сделать это?
Я написал следующий сценарий:
$(function () {
if ($.cookie('toggle') == "toggle") {
$('#toggleText').show();
$('#displayText').text("Less");
}
else {
$('#toggleText').hide();
$('#displayText').text("More");
}
$('#displayText').click(function () {
if ($(this).text() == "More") {
$('#toggleText').show();
$(this).text("Less");
$.cookie('toggle', 'toggle');
} else {
$('#toggleText').hide();
$(this).text("More");
$.cookie('toggle', 'nottoggle');
}
});
})
Файл cookie также не должен удаляться, когда пользователь обновляет браузер.
Спасибо.