iFrame未加载IE 8 [英] iFrame Not Loading IE 8
问题描述
这是我的HTML代码:
< head>
< title>标题< / title>
< link rel =stylesheettype =text / csshref =style.cssmedia =screen/>
< script type =text / javascriptsrc =respond.min.js>< / script>
< / head>
< body>
< iframe src =http://instagram.com/p/cR5BORA8Ij/embed/
width =300height =400frameborder =0
scrolling = noallowtransparency =trueid =myFrame>< / iframe>
< / body>关于我可以做什么的任何建议? =h2_lin>解决方案
以下是完整细目:
重现步骤:
在 html
元素上创建 position:relative
的页面
< html style =position:relative>
< head>< / head>
< body> TEST< / body>
< / html>
这里有一个测试页面,只是这样:
http://jsfiddle.net/KyleMit/DZbt5/show/light
现在使用iFrame中的页面并在IE8中打开
< html>
< head>< / head>
< body>
< iframe src =http://jsfiddle.net/KyleMit/DZbt5/show/light/>< / iFrame>
< / body>
< / html>
这里是一个小调,应该在所有浏览器中工作 IE8
解决方案:
如前面的回答所示,您可以从原始html页面中删除 position:relative
,但您可能无法访问
而是可以简单地向 iframe
元素本身添加相对位置:
iframe {
position:relative;
}
在Fiddle中工作演示 - 也在IE8中工作
其他实例
此处还提出了问题:
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?
解决方案 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未加载IE 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!