Showing posts with label Browser Mode. Show all posts
Showing posts with label Browser Mode. Show all posts

Thursday, July 4, 2013

Change Internet Explorer (IE) document mode programmatically in web applications

I have come across a situation that render the IE browser mode with specific version. While browsing a solution I found below techniques that we can use to change the IE browser mode as follows;

This will workout if you are working on .NET based projects.

Solution 01
Add following code snippet within the head tag of the web page.
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=8" >
</head>

Solution 02
Add following section under <system.webServer> in web.config file in your project. If there is no section exists in the config file, just create and add as bellows;
<system.webServer>
    <httpProtocol>
      <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=8" />
      </customHeaders>
    </httpProtocol>
</system.webServer>
You can specify the Internet Explorer(IE) version by changing the value attribute.