前言

新版Chrome减少了一个性能 SameSite,能够禁止iframe设置cookies。

如果咱们在iframe中须要登录验证,那就比拟麻烦。能够通过禁用这个性能解决。

例子

浏览器控制台提醒:

A cookie associated with a cross-site resource at http://58.211.78.91/ was set without the `SameSite` attribute. It has been blocked, as Chrome now only delivers 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 https://www.chromestatus.com/... and https://www.chromestatus.com/...

如果浏览器中提醒以上内容,而且iframe中的申请中,呈现以下状况:

根本能够确定是_SameSite的问题。_

解决

Chrome拜访 chrome://flags/ ,搜寻_SameSite,找到SameSite by default cookies,这是为Disabled,即可:_

作用是,禁止浏览器的SameSite性能失效。