[英]how to delete angular.js v 1.3 cookies on tab close
i want to delete cookies in angular.js on tab close. 我想在选项卡关闭时删除angular.js中的cookie。
$(window).on('beforeunload', function() {
delete $cookies["Email"];
delete $cookies["isLoggedIn"];
delete $cookies["Token"];
delete $cookies["Name"];
delete $cookies["LogCode"];
});
i have called this function in app.js but it doesn't work. 我已经在app.js中调用了此函数,但是它不起作用。 can you suggest me regarding this issue.
关于这个问题,你能建议我吗? please note: i am using angular.js version 1.3
请注意:我使用的是angular.js 1.3版
Hope this helps 希望这可以帮助
//Handle page refresh and tab close //处理页面刷新并关闭标签
$window.onbeforeunload = function(){
$cookies.remove('Email');
$cookies.remove('isLoggedIn');
//Delete rest of the cookies similarly
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.