相关疑难解决方法(0)

SameSite警告Chrome 77

自上次更新以来,我的Cookie出现错误,与SameSite属性相关。

Cookies来自第三方开发人员(Fontawesome,jQuery,Google Analytics,Google reCaptcha,Google Fonts等)。

Chrome控制台中的错误是这样的。

A cookie associated with a cross-site resource at <URL> was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at <URL> and <URL>.
(index):1 A cookie associated with a cross-site resource at http://jquery.com/ was set without the `SameSite` attribute. A future release of Chrome will …
Run Code Online (Sandbox Code Playgroud)

javascript cookies google-chrome samesite

63
推荐指数
4
解决办法
4万
查看次数

如何修复“将SameSite Cookie设置为无”警告?Chrome扩展程序

我创建了一个chrome扩展程序,并从popup.js中调用了读取cookie的PHP脚本(使用Xhttprequest)。像这样:

$cookie_name = "mycookie";

if(isset($_COOKIE[$cookie_name]))
{
    echo $_COOKIE[$cookie_name];
}
else{
    echo "nocookie";
}
Run Code Online (Sandbox Code Playgroud)

但是我收到扩展错误的警告。

与(此处是我的域)的跨站点资源关联的cookie设置为未设置SameSite属性。如果将来的Chrome浏览器版本将cookie设置为SameSite=None和,则仅会提供带有跨站点请求的cookie Secure。您可以在“应用程序”>“存储”>“ Cookies”下的开发人员工具中查看Cookie,并在https://www.chromestatus.com/feature/5088147346030592https://www.chromestatus.com/feature/5633521622188032上查看更多详细信息。

我试图创建这样的cookie,但没有帮助。

setcookie($cookie_name,$cookie_value, time() + 3600*24, "/;samesite=None ","mydomain.com", 1);
Run Code Online (Sandbox Code Playgroud)

遵循问题的指示。

php cookies google-chrome-extension

23
推荐指数
3
解决办法
3万
查看次数