0

We use IIS8 as our web server. We have an old html page that renders in quirks mode (which is what we want) in ie10 when in a virtual directory. It does not have a tag to force quirks mode. If the page is rendered from within a folder in an asp.net web site it does not render in quirks mode and therefore renders incorectly.

We assume we've changed something in the web site configuration that prevents the page rendering in quirks mode by default. Can anyone suggest what this might be?

To avoid writing an essay on why we're doing what we're doing let me just say that we'd prefer not to have the change the html page to force quirks mode, or change it in any way in fact. It would be much mode convenient to establish what change has caused the page to not render in quirks mode by default and make a change in the application installer to change our customers' web sites automatically.

EDIT: I forgot to mention that in both cases I'm using compatibilty mode.

EDIT 2: We're now targetting .net 4.5 and I've read some stuff online that says that disables quirks mode.

Edit 3: It seems that we switched to 4.5 before this problem became apparent.

Edit 4: The answer is twofold. Prompted by Andrew Morton's comment I did a global search for X-UA-Compatible and found Response.AddHeader("X-UA-Compatible", "IE=edge"); in an Application_BeginRequest handler. However, this predates the problem by several years. It must be that some other change more recentlly combined with this has caused the effect. Anyway, we've spent enough time on this and have decided to add a tag to the html to force quirks mode.

Ian
  • 572
  • 1
  • 4
  • 17
  • How about you fix the page? Never heard of a page that renders incorrectly if NOT in quirk mode. – frenchie Jul 14 '15 at 09:04
  • As I said, there are good reasons to avoid changing the page if that is possible. – Ian Jul 14 '15 at 09:17
  • http://stackoverflow.com/questions/14611264/x-ua-compatible-content-ie-9-ie-8-ie-7-ie-edge has some info on how to force compatibility mode – fozylet Jul 14 '15 at 10:03
  • I'm aware of that, and it does work. It's just that the pages will need to be updated manually on clients' web sites so we'd like to avoid it. – Ian Jul 14 '15 at 10:40
  • Have you checked the HTTP headers to see if an "X-UA-Compatible" has got in there. It could be set in a web.config file under . – Andrew Morton Jul 14 '15 at 11:06
  • Not in Web.config but just did a search of the whole application and found // Turn off IE quirks mode. Response.AddHeader("X-UA-Compatible", "IE=edge"); in Application_BeginRequest!!! – Ian Jul 14 '15 at 11:38

1 Answers1

2

From the IE blog:

IE10’s HTML5 quirks mode is used for pages without a DOCTYPE or with a legacy DOCTYPE as defined in HTML5.

That means that the only thing causing Quirks mode is the page itself. If you don't want to change it, you can't force Quirks mode. There is no server side fix for this. It is all client-side.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
  • As you guessed, there is no DOCTYPE. The issue is that the same page is rendered in quirks mode if it is in a virtual directly outside the asp.net web site. – Ian Jul 14 '15 at 09:15
  • I find that hard to believe since the server doesn't affect quirks mode. Sure ASP.NET doesn't change the file or that your browser remembered setting Quirks mode on a specific page? – Patrick Hofman Jul 14 '15 at 09:17
  • I don't know why asp.net would change an html file, but perhaps it does. When I open the page in the web site in one tab in ie10 it is not in quirks mode. When I open the copy of the page in a separate virtual directory in the next tab it is in quirks mode. – Ian Jul 14 '15 at 09:20
  • Some browser setting maybe? – Patrick Hofman Jul 14 '15 at 09:34