【问题标题】:iframe not loading in firefox onlyiframe 仅在 Firefox 中不加载
【发布时间】:2017-07-19 01:24:49
【问题描述】:

iframe 的内容在 chrome 中运行良好,但在 Firefox 中则不行。我已禁用加载项,但我的 iframe 仍然是空的。我的网站和 iframe 都是 https。

下面是代码:

  <p><iframe class="display:inline-block;" frameborder="0" height="2622px" scrolling="no" src="https://www.emolument.com/start" width="100%"></iframe></p>  

【问题讨论】:

标签: html css firefox iframe cross-browser


【解决方案1】:

试试:

<p><iframe style="display:inline-block; height: 2622px" frameborder="0" scrolling="no" src="https://www.emolument.com/start" width="100%"></iframe></p>

更正了样式属性并将高度声明为 css 而不是高度属性。

顺便说一句,height 属性不应该有 'px'。

【讨论】:

  • 不,这也行不通。仅显示白框。
  • 你可以从地址栏访问emolument.com/start吗? Firefox 最近屏蔽了一些 https 证书。
  • 是的,我可以直接从 Firefox 访问,问题仅在以 iframe 调用时出现
  • 你有第三方插件吗?也许是添加拦截器?
  • iframe的width属性不能有'%',这个属性的单位是px
【解决方案2】:

检查包含 iframe 的网页是否与 iframe 源位于同一域中。如果两者都是 HTTPS,并且在不同的域上,您可能必须处理同源策略。

这是大多数现代浏览器中的一项安全功能,要求页面和 iframe 来自同一来源以允许脚本等。

你可以去看看 Ways to circumvent the same-origin policy

【讨论】:

    猜你喜欢
    • 2016-02-11
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    • 2021-06-11
    • 1970-01-01
    • 2012-11-13
    相关资源
    最近更新 更多