【发布时间】:2023-03-25 13:54:01
【问题描述】:
我有 2 个域。 domain1 上的一个页面使用 iframe 从 domain2 加载内容。如何允许来自 domain2 的链接(在 iframe 内)在 domain1 的完整父框架中打开?
我一直在查看 IE application attribute 和 w3c 的新 sandbox attribute,但我不确定如何实现这些以及它们是否兼容跨浏览器。有没有其他技巧可以解决这个问题?
我可以用 javascript 像素做些什么吗?
【问题讨论】:
-
你试过
target="_parent"iframe中的链接吗? -
是的,页面在新窗口中加载,chrome抛出错误:
Unsafe JavaScript attempt to initiate a navigation change
标签: javascript html security