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>
<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">    
    <mce: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);
            
        }
    
// --></mce:script>
  </head>
  
  <body>
    
    <iframe src="http://www.sohu.com" mce_src="http://www.sohu.com" frameborder="0">
    </iframe>
 
     <input type="button" value="test" onclick="iframeIE6();"/>
     <div id="container">
         
     </div>
  </body>
</html>

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

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

posted on 2013-03-11 11:08  .NET每天一小步  阅读(118)  评论(0)    收藏  举报