IE6下iframe内容不显示bug

IE6下的bug实在多,这不这次又碰到一个。

 

地图搜索结果页面点击一个marker的“更多信息”时,IE7,firefox3.0下都正常。IE6下却无法显示。因为是跨域访问开始以为是http请求慢造成。后更换url后仍然存在。

 

下面是网上的一些资料

 

1、认为src不能写在<iframe的后面

http://be-evil.org/showlog-91.html

http://social.msdn.microsoft.com/forums/zh-TW/236/thread/a01ee23e-08d6-414d-ba22-9922f456af3c/

 

2、认为iframe src的URL长度过长

http://yuweijun.blogspot.com/2008/11/when-iframe-src-is-too-long-in-ie6ie7.html

http://support.microsoft.com/kb/208427/zh-cn

 

3、认为iframe不能自适应高度

http://www.cnblogs.com/KenBlove/archive/2009/03/24/1420464.html

http://www.jb51.net/article/17724.htm

 

新建html测试,bug却没有再现,IE6下可以正常使用,很奇怪?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>IE6 IFRAME bug?</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">	
	<script type="text/javascript">
		
		function iframeIE6() {		
			var c = document.getElementById("container");
			var ifr = document.createElement("iframe");
			ifr.src = "http://www.sohu.com";		
			c.appendChild(ifr);
			
		}
	</script>
  </head>
  
  <body>
	
	<iframe src="http://www.sohu.com" frameborder="0">
	</iframe>
 
 	<input type="button" value="test" οnclick="iframeIE6();"/>
 	<div id="container">
 		
 	</div>
  </body>
</html>
 

最后我猜测是:html书写不规范造成。因为这个结果页面是jsp动态生成的,可能其它代码造成了影响。

 

最后解决方法:先生成iframe,点击“更多信息”时改变iframe的src,之前是采用每次点击删除之前的iframe,添加新的iframe对象。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值