浏览器版本测试

时间:2011-03-29 00:25:34

标签: html

我的html文件中的以下代码对我有用:

<!--[if lt IE 9 ]>
<p class="warning">This page uses newer browser features to display larger versions of the small  images appearing on the right hand side of the page and to enhance the appearance of the page. If you are seeing the message, your browser doesn't support some or all of these features.</p>
<![endif]-->

我想扩展它以测试其他浏览器,但我似乎找不到任何搜索网络的文档,可能是因为我不知道要搜索什么。测试中使用的名称语言是什么,如果它是什么或如何找到它的文档?我还需要找到用于其他浏览器的名称。

由于

3 个答案:

答案 0 :(得分:1)

[if lt IE9]就是所谓的conditional comments.

答案 1 :(得分:0)

jQuery包含一种测试您所在浏览器的方法: http://api.jquery.com/jQuery.browser/

但是你要测试你想要使用的任何功能,而不是浏览器,你会好得多。 BrowserAgent字符串可以很容易地伪造,所以你有时会让Firefox用户伪装成IE用户等。

答案 2 :(得分:0)

这是一个非常广泛的主题,超出了答案的范围。 CSS Browser Hacks For Firefox, Opera, Safari & Internet Explorer应该给你一个良好的开端。

这是Google的reference for Chrome浏览器。