简体   繁体   English

Cookie设置行为不一致

[英]Inconsistent cookie setting behaviour

So I have the following code to set the javascript cookie in the url here 所以我有以下代码来在此处的url中设置javascript cookie

document.cookie = key + '=' + value + expires + cookieDomain + 
cookiePath + secureCookieFlag;

with the following params 具有以下参数

key : "location-and-language", value : "us|en", expires : "; expires=Thu, 31 Dec 2037 00:00:00 GMT", cookieDomain : ";, domain=.name.com", cookiePath : "; path=/", secureCookieFlag : ""

Now the issue is, when I run the same code in two different chrome instances 现在的问题是,当我在两个不同的Chrome实例中运行相同的代码时

1) normal tab : the cookie is set
2) incognito tab : the cookie is not set

Requesting anyone to please help me understand why this different behaviour only because of incognito mode? 要求任何人帮助我理解为什么这种不同的行为仅是由于隐身模式引起的吗?

The purpose of incognito mode is to permit users to navigate without having their history saved in the browser. 隐身模式的目的是允许用户导航,而无需将其历史记录保存在浏览器中。 That includes visited urls, cookies, site and forms data they possibly gathered or entered. 其中包括可能收集或输入的访问过的URL,Cookie,站点和表单数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM