php - 当链接目标为“_blank”时,Internet Explorer 11 丢失 iframe 嵌入式网站的 cookie - 相同的域,不同的子域
问题描述
https://subdomain-b.example.com
当使用iframe
on嵌入https://subdomain-a.example.com
然后单击iframe
在新选项卡/窗口中打开的 cookie 中的链接时,cookie 会丢失。
我不确定它是否与它有关,但一切都是严格的https
。
https://subdomain-a.example.com上的代码:
<iframe src="subdomain-b.example.com/index.php"></iframe>
https://subdomain-b.example.com/index.php上的代码:重要的是链接在 _blank 中打开
<?php
setcookie("TestCookie", "someValue");
?>
<a href="showcookie.php" target="_blank">link</a>
https://subdomain-b.example.com/showcookie.php上的代码:
<?php
print_r($_COOKIE);
https://subdomain-b.example.com/showcookie.php上的响应为空。
这适用于 Firefox、Chrome 和 Edge。
这一定与https://subdomain-a.example.com处理 iframe 内容的方式有关,它在某些实例上有效,而在其他实例上则无效。
解决方案
推荐阅读
- html - Outlook 中的 HTML 表单导致安全违规
- javascript - 如何将文本拆分为单词,同时仅捕获句号和句号之后的空格?
- node.js - SyntaxError, const 数组函数
- c++ - 彩票匹配号码系统,但垃圾邮件你输了
- python - 是否可以对非对称成本矩阵进行聚类
- jquery - 使用 JQuery 在每个 Input Type="number" 中设置不同的计算
- ios - 无权从照片库中挑选照片
- javascript - 立即抓取mySql中自动生成的字段以供使用
- r - tbl_summary 和数值变量
- assembly - 返回到 Eip 寄存器中存储的指令之后的下一条指令