Firefox 不加载 iframe 内容

标签 firefox iframe web same-origin-policy

我在 http://localhost/page1 有一个页面 在该页面上,我显示了 http://localhost/page2某些 div 中 iframe 中的内容。

它在 chrome 中运行良好。但是在 firefox 中,page2 没有显示。
我在 Firefox 控制台中没有收到任何警告/错误。

因为这两个页面具有相同的域。 firefox 应该正确加载 page2 iframe

我是否遗漏了一些明显的东西?

最佳答案

它故意加载一个空的 iframe。这发生在 Firefox 中以防止无限递归。

根据 W3C 框架规范:

Infinite recursion is prevented. Any frame that attempts to assign as its SRC a URL used by any of its ancestors is treated as if it has no SRC URL at all (basically a blank frame). This doesn't prevent all malicious documents, but it eliminates a troublesome class of them.

请参阅随附的 stackoverflow 文章 - 这是我找到答案的地方。

Infinite recursion

关于Firefox 不加载 iframe 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33640783/

相关文章:

python - 是否可以在没有 "any"框架的情况下使用 python 编写 Web 应用程序?

css - img 类标签在 firefox 中无法识别

Selenium Firefox - 浏览器处于远程控制之下

c# - 如何在 iframe 中捕获图像(url)?

javascript - Greasemonkey 代码将 Youtube iFrame 放入剧透中

ruby-on-rails - 为什么我要将 Angular 与 Ruby on Rails 结合使用?

javascript - 捕获WebSocket异常: "Error during WebSocket handshake: Unexpected response code: 503"

javascript - 在 Firefox 的选项卡中显示 pdf 内容

html - Firefox/其他浏览器之间的对齐偏移

javascript - 将 iframe 上的 mousemove 事件冒泡到容器 div