我在 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 文章 - 这是我找到答案的地方。
关于Firefox 不加载 iframe 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33640783/