Tuesday, October 25, 2011

Your website isn’t IE9 Compatible ?

The latest version of the Microsoft web browser  – Internet Explorer 9. Here are just some of the new features to be added to IE9:
  • HTML 5 (Working Draft)*
  • W3C Cascading Style Sheets Level 3 Specification (Working Draft)
  • Scalable Vector Graphics (SVG) 1.0 Specification
Your website isn't IE9 Compatible ?
If you've just downloaded IE9 RC and found that your website no longer works or the layout has become skewed, don't panic!
Whilst you continue working on the updates needed to meet IE9 compatibility you can add some code to the pages concerned or even the entire site in order to force IE 9 to display your page(s) in a previous version compatibility mode.
By default IE 9 will read your web page DOCTYPE to determine the compatibility mode in which to render the page.
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
If your web page doesn't include a DOCTYPE or you need to over-ride the default IE9 behaviour you can do this in a number of ways;
1. Add a meta tag to the page(s) you wish IE9 to render in a previous compatibility mode:
To emulate IE8 mode use :
 
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
 
To emulate IE7 mode use :
 
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
and so on.
If you are able to edit or add additional HTTP headers to be output by your web application then perhaps the best method method is to use the X-UA-Compatible header:


Apache 2.2
 
First, you need to make sure that the headers_module is loaded during server initialization. In the httpd.conf file, uncomment the line by removing the “#” at the start of the LoadModule line for headers_module.  When complete, it should readas below.
LoadModule headers_module modules/mod_headers.so
To add the header to all pages on the server, add thefollowing line to the httpd.conf file after the LoadModule lines.
 
 
Header set X-UA-Compatible “IE=EmulateIE8”
PHP
Use the header() function  to send a custom header. This function MUST be called before any other output is started.

 
//set IE mode header
header('X-UA-Compatible: IE=EmulateIE8');
This will then automatically cue Internet Explorer 9 to use the desired Compatibility settings so that your web application continues to generate web pages which are correctly displayed even in the latest version of Internet Explorer while you work on the long-term compatibility updates.

No comments: