【问题标题】:Is it possible to change height of iFrame from child document when you have don't have access to the parent document?当您无权访问父文档时,是否可以从子文档更改 iFrame 的高度?
【发布时间】:2021-09-21 21:14:08
【问题描述】:

我正在尝试将子文档添加到父文档的 iFrame 中。我无权访问父页面,它始终显示 iframe 高度 0。是否可以从子文档更改此高度?

<html>
    <body>
        <span>This is parent document that I don't have access to.</span>
        <iframe src="src_to_my_page" style="border: none; height: 0px;">
            // document that I have access to.
        </iframe>
    </body>
</html>

无论文档是什么,这个 iframe 的高度始终为 0,而且由于我无法访问父文档,有没有办法改变它?

【问题讨论】:

  • 请在您的问题中提供minimal code to reproduce output
  • @Kshitiz 添加代码
  • @David 已经回答了,您对这个回答不满意吗?我认为这是明确且令人信服的。

标签: javascript dom iframe dom-events iframe-resizer


【解决方案1】:

只能从父页面更改 iFrame 的高度。如果您没有访问权限,那么您很不走运,我们需要与父网站的开发人员交谈

【讨论】:

    猜你喜欢
    • 2013-10-28
    • 2011-06-11
    • 2012-08-06
    • 2015-07-29
    • 1970-01-01
    • 2020-07-19
    • 1970-01-01
    相关资源
    最近更新 更多