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 I also wanted it to not allow IE7 users to use the main site when logged in (they can view public pages.) The reason is that the main web application has a lot of JavaScript effects that will only work 100% in IE8 rendering mode (or any other browser aside from IE.)
The problem with modifying the ie6 upgrade warning to be ie7 is that it looked like IE8 displayed my webpage in an IE7 rendering mode and "lies" about being ie7 and triggers the IE7 stylesheet code.
So how can I force IE8 to always render my page in IE8 mode?
As has been mentioned I'd suggest the best way to achieve this is to use conditional comments to include a stylesheet specific to all versions of IE earlier than 8:
The included CSS could set a warning to be visible or perhaps enable an overlay on the page which 'locks' users out. It might be a good idea to include some rules which hide important elements on the page which could otherwise confuse the user if they do not work as intended.
Your other option is to redirect the user to another page - I'm not a huge fan of redirects but if used with care they can be a suitable solution.
Have you considered why you're locking a large amount of users out of your site? Maybe you should take the time to work out how to either gracefully degrade your JavaScript, or the other way around; 'progressively enhance' with JavaScript.
On the other hand, you might have control over the systems used by the organisation using your site in which case you're probably OK locking people out for using non-standard systems.
Using javascript you can ask which browser have sent the request>
Correction to AdamSane's example:
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
Depends on how you've coded your (X)HTML, but IE8 should use standards mode (not IE7 mode) if you have a strict doctype like:
at the top of your HTML files.
XHTML 1.0 Specs - Strictly Conforming Documents
Here's a good post about how different doctypes/etc affect IE8's rendering mode: Understanding Compatibility Modes in Internet Explorer 8
Use this tag: