iframe - 如何修复 ‘The frame being accessed is sandboxed and lacks the "允许同源“标志”

标签 iframe safari sandbox

在 Safari 中执行这段代码时

iframe.contentDocument || iframe.contentWindow.document

我得到一个错误

Sandbox access violation: Blocked a frame at "My url" from accessing a frame at "null". The frame being accessed is sandboxed and lacks the "allow-same-origin" flag.

iframe 是这样形成的:

'<iframe name="'+name+'" id="'+name+'" src="'+src+'" sandbox="allow-same-origin">'

在调试器中,我可以获得具有给定值的属性 iframe.sanbox

我做错了什么?

最佳答案

浏览器会根据网站的偏好自动阻止网站加载。您尝试加载的网站必须设置:

X-Frame-Options: DENY
X-Frame-Options: SAMEORIGIN

来自 this answer .

关于iframe - 如何修复 ‘The frame being accessed is sandboxed and lacks the "允许同源“标志”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54560333/

相关文章:

objective-c - Lion 下的 NSUserDefaults 和沙盒

css - 如何更改 YouTube iframe 的 CSS 样式

javascript - 覆盖在 iframe 中加载的外部页面的 getFocus

javascript - 获取 iframe.contentDocument iframe 的对象 null 使用带有所需选项的 jsdom 创建 iframe

javascript - 在 iPad 上模拟滚动事件

python - Django oscar 沙箱编辑或 django oscar 文档

c - 子进程的内存使用情况?

java - 如何使用 HTTP 响应代码检查外部 URL 内容是否正确加载到 JSP 页面中的 <IFRAME>

javascript - 为什么 Safari 页面会破坏 iOS 渲染?

javascript - 如何阻止 Safari 在我的 &lt;input type ="search"> 字段中放置放大镜图像?