iFrame内容不会在IE8中显示

iFrame内容不会在IE8中显示

本文介绍了iFrame内容不会在IE8中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个网站的iFrame。



主机页面上有一些非常基本的JS,iframed页面也有简单的JS。



当我像往常一样嵌入iframe时:< iframe src =iframeURLwidth =900height =1000>< / iframe> 它在所有浏览器,但IE8工作正常。



我尝试了各种各样的事情:




  • 首先:停用所有JS

  • 删除src属性并将其添加到JS

  • 使用 ; object> 代替

  • 我使用proxy.php使内容显示为来自同一个域
  • / ul>

    它不会在IE8工作,不管我做什么。



    有趣的是,我可以打开



    如果我将src属性更改为some_other_random_page_from_internet,它可以正常工作。



    另一件事是主机和iframe使用postMessage进行通信,我可以看到通信正在工作,它只是内容不显示,但当我检查页面源代码与开发工具我可以看到内容是存在的。



    iframe的内容是否可能会导致问题?这是一个基本的HTML +基本的JS,JS禁用它不应该是一个问题。



    任何想法我还能检查什么?



    PS。我无法显示代码(NDA等)

    解决方案

    ,真正的答案是设置 position:relative 在iframe本身,因为你可能没有编辑html源页面的能力,或者它可能需要使用相对定位。



    只需添加这个CSS,你应该全部设置:

      iframe {
    position:relative;
    }

    我在


    I have a site with an iFrame.

    The host page has some very basic JS on it, the iframed page has simple JS too.

    When I embed the iframe as usualy: <iframe src="iframeURL" width="900" height="1000"></iframe> it works fine in all browsers but IE8.

    I tried various things:

    • first: disabling all JS
    • removing src attribute and adding it with JS
    • using <object> instead
    • I used proxy.php to make the content appear as if it were coming from the same domain

    It doesn't work in IE8 regardless what I do.

    The funny thing is that I can open the page I want to iframe in a separate tab and works just fine.

    If I change the src attribute to "some_other_random_page_from_internet" it works.

    The other thing is that both host and iframe use postMessage to communicate and I can see the communication is working OK, it's just the content which doesn't show, but when I inspect the page source with developers tools I can see the content is there.

    Is it possible that the content of the iframe causes issues? It's a basic HTML + basic JS, with JS disabled it shouldn't be an issue.

    Any ideas what else I could check?

    PS. I can't show the code (NDA , etc)

    解决方案

    For visibility of Lukx's comment, the real answer is to set position:relative on the iframe itself, since you might not have the ability to edit the html source page or it might need to use relative positioning.

    Just add this CSS and you should be all set:

    iframe {
        position: relative;
    }
    

    I wrote up a full description of the problem in this answer

    这篇关于iFrame内容不会在IE8中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    1403页,肝出来的..

09-06 07:41