0

我有一个脚本加载到 iframe 中,试图使用$(frameElement).closest('div'). 这在 Chrome 和 Firefox 中运行良好。但在 IE11 上,它说Permission Denied. 它能够访问 iFrame 元素,但不允许对其进行任何类型的操作。
还有其他 iFrame(访问元素的相同脚本也存在于所有这些 iFrame 中)加载到同一页面中。在所有其他 iFrame 中,即使在 IE11 中也可以正常工作,但是这个 iFrame 不起作用。此 iFrame 与其他 iFrame 之间的唯一区别是此 iFrame 具有子 iFrame。

PS:iFrame(我试图通过 $(frameElement) 访问的那个)和父级在同一个域中,并且有 2 个子 iFrame 一个的 src 为空白,另一个来自不同的域。此外,访问 iFrame 的脚本会加载到父 Iframe 中。结构是这样的,网页域也是a.com,我在这里尝试访问父iframe。在这里,$(frameElement) @ script-to-access-iframe 返回 Iframe 元素,在 IE11 中使用最接近的()表示“权限被拒绝”。

<body>
   <div>
      <iframe id="parent" src="wwww.a.com">
        #document
          <html>
             <body>
                <script src="www.a.com/scripts/script-to-access-iframe">
                <div>
                   <iframe id="child1" src="about:blank">
                   <iframe id="child2" src="www.b.com">
                </div>
             </body>
          </html>
   </div>
</body>
4

0 回答 0