0
我在我的项目中使用了angularjs1.5.5。关闭浏览器后,为什么不保存cookie?
我使用$饼干服务在我project.I创建并存储在cookie中的一些凭证:
this.setCookie = function (inspectorName) {
$cookies.put('inspectorName', inspectorName, {
expires: new Date(new Date() + 1, new Date().getMonth(), new Date().getDate())
});
}
在这里,我如何访问饼干:
var credentials = $cookies.get('inspectorName');
但是当我关闭和打开页面,我尝试按行获得上面的cookie,我得到'未定义'。
任何想法为什么cookie在关闭浏览器后没有保存?
expires value is null as null。因此其取消到期时间作为浏览器会话。意味着cookie的生命将在浏览器关闭时过期 –