Setup the document like this:
<!doctype html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>
For IE10 use this:
if (Function('/*@cc_on return document.documentMode===10@*/')()
){
document.documentElement.className+=' ie10';
}
Then, what you do with these classes depends on whether you want to just show/hide a div with css, or use javascript to redirect the page.
Javascript:
(function ($) {
"use strict";
// Detecting IE
var IE;
if ($('html').is('.ie6, .ie7, .ie8, .ie9, .ie10')) {
IE = true;
}
if (IE) {
// redirect
window.location.replace('http://www.myotherpage.com');
}
}(jQuery));
OR CSS:
.ie6 .myDivClassName,
.ie7 .myDivClassName,
.ie8 .myDivClassName,
.ie9 .myDivClassName,
.ie10 .myDivClassName {
display: block;
}
Depends on what you are trying to do.