Blocking IE 7 / IE 8 compability mode users?
On our website we currently implemented logic to block IE 6 users. But IE 7 is equally crappy and it requires a lot of work to make the stylesheets wor开发者_开发问答k so we are deciding if we block IE 7 will this affect IE 8 users who run compatibility mode (which mimics IE 7) or will it only block people who have Ie 7 installed? I would like to block only people who use IE 7 but allow people who use IE 8 in compability mode but display a warning to them that this site requires pure IE 8. Or to make life easier i could block IE 8 in compability mode? And if so how to do this compability mode check in php?
Do not block visitors based on the browser they use. Create the website in such a way that it works with all browsers. Use progressive enhancement to provide usability enhancements for people that use browsers with better support for current web standards.
You can prevent IE to not render in compatibility mode by adding the following to your .htaccess file:
Header set X-UA-Compatible: IE=Edge
This will tell IE to always render the page to the latest version of IE (edge)
This is discussed further here : http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx
alternatively you can add the following in the header of the pages you wish not to be used in compatibility mode :
<meta http-equiv="X-UA-Compatible" content="IE=Edge" >
When IE8 goes into Compatibility mode it acts just like IE7.
That means that if you allow IE8 in Compatibility mode to enter, then you're pretty much allowing IE7.
精彩评论