简体   繁体   中英

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 browsers, 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM