开发者

Browser Version Test

The following code in my html file is working for me:

<!--[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]-->

I want to expand it to test for other browser开发者_Python百科s, but I can't seem to find any documentation searching the web, probably because I don't know what to search for. What is the name language used in the test if that is what it is or how would I find documentation for it? I also need to find the names used for other browsers.

Thanks


The [if lt IE9] is what is known as conditional comments.


jQuery includes a method of testing for which browser you're in: http://api.jquery.com/jQuery.browser/

But you're much better off testing for whatever feature you're looking to use, rather than browser. The BrowserAgent string can be forged quite easily, so you'll sometimes get Firefox users masquerading as IE users, etc.


This is a very broad subject, beyond the scope of an answer here. CSS Browser Hacks For Firefox, Opera, Safari & Internet Explorer should give you a good start.

And here is reference for Chrome browser by Google.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜