IE对refresh (meta) 的解析有Bug

类别: 前端开发 — 标签: , , — honk @ 2010-05-19 16:27:09

今天和同事发现一个诡异的问题, 系统邮件发出后, 在Gmail中点击邮件中的链接时,部分链接在IE7/IE8下不能正常访问(IE6正常).
具体为: 不能打开含有分号(;)的链接, 从gmail中点开后分号及以后的内容丢失, 从而出现找不到页面.

初步测试, 发现Gmail在打开链接时, 会由js修改click事件, 将目标链接改为gmail自己的一个中间页, 再在该页做跳转(可能google利用这过程做了一些统计工作吧)
当目标链接地址含有分号(;)时, IE7/8都不能正常跳转, 而其他浏览器却是正常的.

起初以为这是Gmail的Bug, 怀疑google对目标链接用js做了些编码转换,而不同浏览器对这个编码转换支持有差异.

我抓取了跳转页的内容, 其实就一行标准的refresh代码:

<meta http-equiv=”refresh” content=”0; url=http://soido.org/?honk;hello”>
而且, 目标链接中的分号是存在的, 也并没有被做任何编码转换.

自己再复制该行代码写了个例子,
发现除IE外的所有浏览器都能正常跳转, 而IE的所有版本都去掉了目标链接的”;hello”.

原来竟是IEBug, 至于前面IE6能正常访问gmail中的链接, 估计是gmail的js并未对IE6做完整支持, 链接并没有经过中间页跳转,所以能正常访问.

虽然带分号(;)的url比较少见, 但也不是没有, 我们后来的解决方法是在生成邮件内容时, 将链接中的分号都做一次url编码, 即转成%3B. 不知有没有更好的方案?

7 Comments »

  1. 这标题读起来很啰嗦啊

    Comment by honk — 2010-05-19 @ 23:09:34

  2. 有没有简单一点的啊

    Comment by 武汉房地产网 — 2010-05-20 @ 15:23:26

  3. 学习了

    Comment by cool860613 — 2010-05-24 @ 19:27:07

  4. 支持喽!博客不错!

    Comment by 66 — 2010-06-08 @ 16:01:57

  5. 写得真有水平

    Comment by 签名设计网 — 2010-06-28 @ 20:48:54

  6. 我也来试试先

    Comment by 韩剧排行榜 — 2010-06-29 @ 07:24:40

  7. 确实是有这个诡异的问题,哈哈。

    Comment by 飞鸽传书 — 2010-06-29 @ 10:44:55

RSS feed for comments on this post. TrackBack URL

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Powered By WordPress and soIdo