IE下iframe不能正常加载,显示空白

         下午帮忙看了一个web问题,index.html中嵌入<iframe>来加载同文件目录下的一个页面,在多个浏览器下测试,发现IE浏览器中会出现问题,<iframe>不能正常加载,显示空白页,右键属性为"_blank"

 

         一开始,想到的是src属性的问题,可能是路径不对,但是经过不同浏览器测试,不存在路径问题。

 

        单独把src路径拿出来,贴到IE浏览器中,发现页面加载没问题。通过分析,问题应该出现在index.html文件中,单独的<iframe>加载ok,通过排除法,就是Index.html文件中某些代码出现了问题,使得IE浏览器发飙了。

 

        然后,上网找寻答案,有很多很多的帖子在问相关问题,也有很多人开博写这种问题的解决办法,大概罗列如下:

 

       1.IE浏览器的bug<iframe>标签的src属性不要放到第一位,因为这样会诱发IEbug.

 

      2.采用动态创建dom节点的方式,来创建<iframe>动态加载页面。

    

      后来经过大勇的测试发现,将index.html页面头部的<!--saved from url=(0022)http://www.yoururl.com -->代码去掉之后,页面加载问题解决了,但是这行代码的作用何在?

 

      这也是解决了本问题的一个方案,经过查阅资料,这行代码的用途是IE下安全验证的一个设置,来控制是否会弹出黄色的消息提示框,来提醒你是否允许此Active运行在客户端。

 

  1. <span style="font-size:18px;">To allow active content or scripting to run in a web page without the   
  2. Information Bar appearing, you can add "Mark of the Web" code,   
  3. so that the file is run in a zone other than the Local Machine zone,   
  4. for example the Internet zone or the Intranet zone.  
  5.  The following code is an example of a Mark of the Web:   
  6.   
  7. <!-- saved from url=(0022)http://www.yoururl.com -->  
  8.   
  9. To include the code above in your projects, change the URL   
  10. to point to your domain, and change the number (0022) to the  
  11.  correct number for your domain. This number indicates   
  12. how many characters are in your domain name (beginning with  
  13.  the "h" in "http", and ending with the last letter of your domain;  
  14. for example, the "m" in ".com").   
  15.   
  16. A generic way of writing the Mark of the Web code is as follows:   
  17.   
  18. <!-- saved from url=(0014)about:internet -->  
  19.   
  20. about:internet will place the page in the Internet zone,   
  21. allowing the page to bypass the Local Machine zone lockdown. </span>  

       此代码是用来控制哪些用户访问时不会提示验证提示框,而我们如何跳过这个设置,来运行我们的web项目呢?

     

      我们可以远程预览页面或者在本地部署iis/tomcat服务器来运行项目,这样就可以在IE下正常加载<iframe>页面,并且不影响安全性验证提醒。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值