iFrame Not Loading IE 8 [duplicate]

扶醉桌前 提交于 2019-12-31 05:14:31

问题


My website seems to work in all browsers but IE 8. Everything loads fine by the iFrame.

Here is my HTML code:

<head>
   <title> Title </title>
   <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
   <script type="text/javascript" src="respond.min.js"></script>
</head>

<body>
    <iframe src="http://instagram.com/p/cR5BORA8Ij/embed/" 
            width="300" height="400" frameborder="0" 
            scrolling="no" allowtransparency="true" id="myFrame"></iframe>      
</body>

Any suggestions on what I could be doing wrong?


回答1:


Here's a full breakdown:

Steps to Reproduce:

Create a page that has position:relative on the html element

<html style="position:relative">
    <head></head>
    <body>TEST</body>
</html>

Here's a test page in fiddle that does just that:

http://jsfiddle.net/KyleMit/DZbt5/show/light

Now use that page inside of an iFrame and open in IE8

<html>
    <head></head>
    <body>
        <iframe src="http://jsfiddle.net/KyleMit/DZbt5/show/light/"></iframe>
    </body>
</html>

Here's a fiddle that should work in all browsers EXCEPT IE8

Solution:

As the previous answer suggests, you can remove position:relative from the original html page, but you might not have access to the page or be able to change it.

Instead, you can simply add relative position to the iframe element itself:

iframe {
    position: relative;
}

Working Demo in Fiddle - Also works in IE8

Other Instances

Question was also asked here:

  • iFrame content doesn't show in IE8
  • Blank iFrame in IE



回答2:


From the question iFrame content doesn't show in IE8:

Just remove the following rule from the iframed content:

html { position: relative; }


来源:https://stackoverflow.com/questions/17930418/iframe-not-loading-ie-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!