iframe 内的 iframe 访问自己的 cookie

时间:2021-03-17 15:34:21

标签: cookies iframe cross-domain fetch-api

我在顶级网站上有一些身份验证 cookie。

在其中呈现外部域 iframe。在 iframe 中,我们从顶级域中添加另一个 iframe。

在我们的 iframe 中,我们需要访问 cookie,但我们得到的只是空值。

cookie 是 SameSite: Lax, Secure: none, HttpOnly: false

我在获取请求上使用 set credentials: 'include' 进行了测试 - 不起作用

在底部 iframe 上使用 sandbox='allow-same-origin allow-scripts allow-forms' - 仍然没有。

有没有办法允许 iframe 访问 cookie?

enter image description here

1 个答案:

答案 0 :(得分:0)

我认为您需要读取父级上的 cookie,然后将其放在本地存储中以供 iframe 读取。

相关问题