用于检测旧版 Internet Explorer 并提供下载较新浏览器的 Javascript

标签 javascript internet-explorer cross-browser

我正在寻找可以粘贴到页面上并完成它的好看的东西。

脚本应该检测早于 9 的 IE 版本,并显示一个漂亮的弹出窗口,其中包含指向不同浏览器或类似内容的链接。我可以自己做,但我不想重新发明轮子。

最佳答案

当我第一次发布这个答案时,modern.IE项目正在插入 IE6 countdown倡议,其中一部分是提供 IE 检测片段和托管图像,用于警告用户他们使用的是旧浏览器。

我最初链接到 http://www.ie6countdown.com/现在重定向到不再提供片段和图像的 modern.IE 上的一个区域。因此,为了繁荣和引用,这里是他们共享的代码和 imgur 上托管的原始横幅图片:

<!--[if lt IE 7]>
<div style=' clear: both; height: 59px; padding:0 0 0 15px; position: relative;'> 
  <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode">
    <img src="http://i.imgur.com/hNingci.jpg" border="0" height="42" width="820" alt="" />
  </a>
</div>
<![endif]-->

如果你想改变它来检测小于 9 的 IE 版本,只需将代码的第一位更改为:

<!--[if lt IE 9]>

关于用于检测旧版 Internet Explorer 并提供下载较新浏览器的 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10212503/

相关文章:

css - 一个UL内的IE7间距

Internet Explorer 中的 Javascript 变量意外更改

javascript - HTML/CSS : what's a better option for layout of a tree of nested elements than nested tables?

firebug 的 javascript 判断

css - 跨浏览器渐变问题

javascript - 删除数据(刷新)WebGL Globe

javascript - 修复了对 slickgrid 进行排序时底部的一行

javascript - Polymer,如何使用应用程序定位?

javascript - 查找具有条件的数组对象序列

jquery - 清除 IE 中的 FILE 输入可防止后续更改事件