Question

I'm using html5boilerplate with the Modernizr library. My application is built using jQuery. Both Modernizr and jQuery have feature detection built in, but my understanding is that Modernizr is more complete. I'm planning to use Modernizr for feature detection unless there is a good reason to use jQuery for this.

My application is intended to only work with more modern browsers (such as IE7+, Firefox, Chrome, Safari, and newer Opera), however it still works somewhat in IE6. I'd like to make sure the users see a big fat warning if they are using an older browser such as IE6. I'd also like to display a "suggestion" to upgrade to Chrome or some other HTML5 compliant browser if they are not using one already.

I don't want to use user agent testing.

  • Is there a specific list of features that I should test for in order to determine if the user is using IE6 or not?
  • Is there a specific list of features that I should test for to determine if the user is browsing with a fairly compliant HTML5 browser (Chrome, Safari, IE9, etc.)
Was it helpful?

Solution

You say you're using HTML5Boilerplate. At the very top of the index.html is this:

<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> 

So using jQuery, plan old javascript or even css to simply test for the existence of the ie6 class on html.

<style>
.upgrade-notice { display: none; }
.ie6 .upgrade-notice { display: block; }
</style>

<div class="upgrade-notice"><h1>Please upgrade your browser</h1></div>

OTHER TIPS

Use conditional comments for IE version testing.

<!--[if lt IE 7]><script>window.location='/main/unsupported_browser';</script><![endif]-->

As for the rest you should only test for features you use and only when you use them. That way you will degrade gracefully and won't accidently block a browser that works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top