javascript - 仅具有本地范围 cookie 的沙盒 iframe
问题描述
是否可以加载可以运行脚本和写入 cookie 但不会覆盖父 cookie 的 sanboxed iframe?
例如,外部 HTML 将如下所示:
外部.html
<html>
.....
<script>document.cookie='page=outer; path=/';</script>
<iframe sandbox="<attribute-here>" src="./inner.html"></iframe>
.....
</html>
内部.html
<html>
.....
<script>document.cookie='page=inner; path=/';</script>
.....
</html>
期望的结果是外部页面始终保留 cookie 值outer
,而内部页面具有值inner
解决方案
推荐阅读
- neo4j - 在 Linux 上从命令行停止 neo4j
- c - 为什么 strlcat 和 strlcpy 是 unsigned int 而不是 void?
- dataframe - 重命名数据框列名 julia v1.0
- java - Android(9)Pie中如何允许所有网络连接类型HTTP和HTTPS?
- mysql - 如何优化多个 LEFT JOIN
- javascript - tsconfig 文件中的语法错误?
- kendo-ui - 剑道PDF导出
- node.js - Netlify 上的 React/Node 部署
- linux - 为什么需要使用 inotify_add_watch() 调用 read() 两次
- mysql - 创建 MySql 触发器并通过插入表设置变量中断