使用JavaScript检测Internet Explorer 6的最佳方法是什么? [英] What is the best way to detect Internet Explorer 6 using JavaScript?

查看:82
本文介绍了使用JavaScript检测Internet Explorer 6的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JavaScript检测Internet Explorer 6的最佳方法是什么?

What is the best way to detect Internet Explorer 6 using JavaScript?

If browser == IE6 {
    alert('hi');
}


推荐答案

条件评论是个不错的选择:

Conditional comments are a good alternative:

<!--[if IE 6]>
<script>
var everythingIsBroken = true;
</script>
<![endif]-->

编辑:如果您仍希望在2017年支持IE 6或者......好吧,我的心向你倾诉。 2017年这个问题的答案实在不用担心IE 6.它不再是受支持的浏览器了。任何可以运行此浏览器的操作系统和浏览器本身都不再获得安全更新。这意味着使用此软件的用户很有可能被利用。对于负担不起升级的人来说,这是一个大问题。

Edit: If you're still looking to support IE 6 in 2017 or after ... well my heart goes out to you. The answer to this question in 2017 is really not to worry about IE 6. It's not a supported browser anymore. Any operating system that can run this browser and the browser itself are not getting security updates anymore. This means users using this software are at great risk of being exploited. This is a big problem for people who can't afford to upgrade.

这篇关于使用JavaScript检测Internet Explorer 6的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆