0

How do i change the 'Document Mode' of IE in web config?

I have developed a website and it works good in my local. But after publishing, when am trying to open the site i could see some misalignment.i checked the document mode using developer tool it is IE7 standards.

When i change it in to IE9 there it works as expected.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Gayathri
  • 85
  • 2
  • 11
  • 1
    You can use the `` meta tag in your master page or page. [See this SO question](http://stackoverflow.com/questions/6771258). – Uwe Keim Dec 05 '14 at 06:45
  • I added below code in we config but still this issue is there – Gayathri Dec 05 '14 at 06:48
  • You need to have it as an **HTML** header. What you did is to add an **HTTP** header, this is something different. – Uwe Keim Dec 05 '14 at 06:55
  • But i got this solution from here http://msdn.microsoft.com/en-us/library/jj676913%28v=vs.85%29.aspx – Gayathri Dec 05 '14 at 07:02
  • OK, seems it is possible to use it as HTTP header, too. I've never tried, I've only worked with HTML headers successfully. – Uwe Keim Dec 05 '14 at 07:40
  • 1
    @UweKeim - The meta tag is unreliable because often the mode is selected already before the browser renders the tag. Using the header is the preferred method, and always has been. – Erik Funkenbusch Dec 06 '14 at 05:08

1 Answers1

1

Don't use Emulate-IE9, just use <add name="X-UA-Compatible" value="IE=edge" /> This will cause IE to always render in its most standards compliant mode.

However, your problem is most likely not this header. It's probably that you are not using a proper doctype tag, or you are doing something else to force IE into compatibility mode. The X-UA-Compatible header will not fix a basic problem with your HTML validity that causes compatibility mode.

Another possibility is if you are on a corporate network and they are overriding the compatibility mode for your site (usually because they are trying to make older apps on the same site work). In which case, you will need to talk to your network administrators to fix the problem.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291