【问题标题】:Firefox blocks the loading of HTML iframeFirefox 阻止加载 HTML iframe
【发布时间】:2021-06-11 21:38:06
【问题描述】:

我想使用 HTML iframe 加载另一个页面,但 Firefox 因避免安全问题而阻止了它。 .

我尝试将“https”更改为“http”,但它不起作用。

Firefox 显示的错误:

Firefox Can’t Open This Page 
To protect your security, anouar.stencila.io will not allow Firefox to display the page if another site has embedded it. To see this page, you need to open it in a new window.

这是使用的代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Reproducible Article</title>
  </head>

  <body>
    <!-- The header of the file -->
    <p>
      <a
        href="https://ojs3.josekarvalho.net/index.php/rp/article/view/87/176"
        target="_blank"
        >Link to HTML version</a
      >
      |
      <a
        href="https://ojs3.josekarvalho.net/index.php/rp/article/view/87/181"
        target="_blank"
        >Link to PDF version</a
      >
    </p>

    <!-- The iframe to be shown - the link to the reproducible article allowfullscreen -->
    <iframe
      src="https://anouar.stencila.io/gentsch2020/"
      frameborder="0"
      style="position: absolute; top: 80px; left: 0; width: 100%; height: 100%"
      scrolling="yes"
      title="Reproducible Article"
    ></iframe>
  </body>
</html>

【问题讨论】:

  • 在手机上,所以无法真正检查,但这听起来确实符合您尝试嵌入的网站发送x-frame-options 标头或类似的防止 iframe 的要求。如果您无法访问他们的后端,您将无能为力。
  • @Kaiido 感谢您的回复,您指的是哪个后端?

标签: html firefox iframe


【解决方案1】:

页面https://anouar.stencila.io/gentsch2020/ 使用以下X-Frame-Options 标头:

x-frame-options: allow-from *.ojs3.josekarvalho.net

ALLOW-FROM 不受任何最新浏览器的支持,因此无法正常工作。您要么需要尽可能使用SAMEORIGIN,要么完全删除标题。

X-Frame-Options 可以替换为Content-Security-Policy: frame-ancestors &lt;source&gt;;,参见MDN

【讨论】:

  • 感谢您的回答,但我不明白如何删除 X-Frame-Options 标头,我需要 ojs3.josekarvalho.net 的链接才能使用此 url 调用页面跨度>
猜你喜欢
  • 2016-10-19
  • 1970-01-01
  • 2018-08-19
  • 2012-09-19
  • 2011-01-13
  • 1970-01-01
  • 2015-03-12
  • 2016-06-30
相关资源
最近更新 更多