I want to only allow users with IE8 (not IE6, IE7) or another browser to access my site when logged in.
I followed: http://code.google.com/p/ie6-upgrade-warning/ But
Rather than try to force IE 8+ mode, I use a combination of conditional comments and a simple javascript check. The document.documentMode
property was added to IE in version 8, so if it exists at all (regardless of value, though it HAS to be 7 with this code) it means we're in compatibility mode and should not show the warning:
<!--[if lte IE 7]>
<script>
if (!document.documentMode) { //if documentMode exists, this is a later IE in compatibility mode
showBadBrowserMessage();
}
</script>
<![endif]-->
You can use CSS Conditional Comments
<!--[if IE 8]>
Special instructions for IE 6 here
<![endif]-->
here is a good link that suggest some solution
http://garmahis.com/tools/ie6-update-warning/
personally i like fourth solution(http://www.browser-update.org/)
just a piece of cake
Correction to AdamSane's example:
<!--[if lt IE 8]> Special instructions for IE 7 or less here <![endif]-->
Use this tag:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
Here is this cool script that works for all old browsers:
<script type="text/javascript">
var $buoop = {vs:{i:7,f:5,o:12,s:5,n:9}};
$buoop.ol = window.onload;
window.onload=function(){
try {if ($buoop.ol) $buoop.ol();}catch (e) {}
var e = document.createElement("script");
e.setAttribute("type", "text/javascript");
e.setAttribute("src", "//browser-update.org/update.js");
document.body.appendChild(e);
}
</script>
Note: If the visitor ignores the advice, it won't appear again for some time.
More can be found: here