谈谈关于IE8的一些bug,主要是base href

 

在IE8浏览器中,有个非常常见的bug,在我们使用ZF框架进行开发的时候,就碰到了base href的bug问题。经过了一天的测试,才最后找到

 

原因,过程如下:

 

用户新安装的IE8,是有不少bug的,IE8内部采用了一定的加速机制,正如:

 

http://blogs.msdn.com/b/ieinternals/archive/2009/07/27/bugs-in-the-ie8-lookahead-downloader.aspx#comments

 

里面介绍的,IE8有大量的特性用来更快的渲染页面,其中的一大特性是:“前瞻性下载器(这个翻译不一定准确,意思懂就可以了)”("Lookahead Downloader"),能够非常快速的扫描页面,寻找一些资源的url地址,它在主要的解析器之前运行,而且非常简单,它的唯一工作就是:搜寻那些资源的url,然后尽快的获取这些请求加入到请求队列中,这些下载的请求称为“预测性下载”("speculative downloads" ),因为它不知道是否这些资源真的是被需要的,,这时候,主要的解析器到了包含url的标签中,例如:在主要的页面渲染阶段,内部的js运行,理论上是可以移除这些首先激活“预测性下载”的标签,然而,这种“预测性丢失”("speculative miss")的边际性bug不是经常遇到,即使碰到了,一般是没有问题的,因为这只是下载了一个重来不会用的的文件。

 

原文如下:

 

Internet Explorer has a number of features designed to render pages more quickly. One of these features is called the "Lookahead Downloader" and it's used to quickly scan the page as it comes in, looking for the URLs of resources which will be needed later in the rendering of the page (specifically, JavaScript files). The lookahead downloader runs ahead of the main parser and is much simpler-- its sole job is to hunt for those resource urls and get requests into the network request queue as quickly as possible. These download requests are called "speculative downloads" because it is not known whether the resources will actually be needed by the time that the main parser reaches the tags containing the URLs. For instance, inline JavaScript runs during the main rendering phase, and such script could (in theory) actually remove the tags which triggered the speculative downloads in the first place. However, this "speculative miss" corner case isn't often encountered, and even if it happens, it's basically harmless, as the speculative request will result in downloading a file which is never used.

 

 

Bugs in IE8's Lookahead Downloader

 

一段代码,如果没有打上IE8的补丁,

 

 <html><head><base href=B><script src=relC><base href=B><script src=relD><base href=B><script src=relE><body>

 

如果要想使用base href,必须要在每个引入的js中使用这个标签,否则第一个script找到了以后,第二个javascript会无法找到,因为它的当前路径已经修改了,按照当前页面的全路径来进行解析了,于是仔细使用HTTPWATCH PROFESSIONAL 7.0进行查看,你会发现之后的js在引入的时候,都是报400错误,于是在ZF框架中,默认进入到了index/index的action中,这个地方很需要注意。解决方法是:

 

通过src引入js的时候,"/main/js/util.js",这里的main目录是在/var/www/html/test/model目录下,这这里的model是作为PHP的include_path被自动引入的。

 

很多时候,不同的用户,都使用IE8,结果有的是正常的,有的不行,于是就出现了一些问题,最后才发现原来是IE8的bug。因为我的电脑打了补丁。

 

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值