How can a page in IE render differently between Cassini and IIS7?
Asked Answered
O

5

13

I am completely confused - I have a website that renders perfectly in IE8 when run through Cassini (in Visual Studio) but has several messed up elements (style/look) when deployed to localhost and viewed through the same browser (IE8).

I have run Beyond Compare 3 on the html and CSS files and they are exactly the same. Are there any circumstances where IIS7 could be somehow sending extra/different information to the browser? Has anyone run across something like this before?

Note that Chrome and Firefox both render the same webpage just fine through Cassini and IIS7.

(Update) What Browser Mode and Document Mode does IE8 Developer Tools think you are in if you press F12?

When running from Cassini (http://localhost:22120), IE8 stays in IE8 mode (with the option for turning on IE7 compatibility view) and everything looks great.

When running from IIS7 (http://{machine name}), IE8 automatically goes into in IE8 Compat View, IE7 standards and things look horrible.

Oilcloth answered 30/10, 2009 at 17:36 Comment(3)
Have you Beyond Compared the results of a "File | Save As..." MHT file to see what is actually different?Allpowerful
Also, what Browser Mode and Document Mode does IE8 Developer Tools think you are in if you press F12?Allpowerful
Best question in Stack Overflow. Ever. =)Codification
A
17

My assumption (as mentioned in my comment earlier) was that IE is working in a different rendering mode, depending on whether you are using IIS or Cassini, and this is causing the layout differences. It actually appears to be IE that is causing this, based on the settings found in Tools | Compatibility View Settings. There are two check boxes:

Display intranet sites in Compatibility View - this is checked by default. Display all websites in Compatibility View - this is not.

Either way, you should use the standard meta tag to force the mode you wish to be rendered in.

<meta http-equiv="X-UA-Compatible" content="IE=8" />

Hope this helps.

Allpowerful answered 30/10, 2009 at 19:52 Comment(3)
This is the answer. "localhost" is special-cased to be treated like Internet-zone content, while (by default) machinename is treated like Intranet-zone content.Foreland
A little bit of extra info which I found was required to fix my problem: when run in intranet mode, if not specified otherwise, IE defaults to "IE=EumulateIE7" mode. Whereas the default for the internet zone is "IE=8" mode. Since my site was working fine on the intranet, I had to use "IE=7". (IE=EmulateIE7 would have also worked, but under some circumstances this can wind up rendering in IE5 mode, which is not exactly desirable)Bibb
3.5 years later, this helped me out as well!Blisse
D
5

I think the best solution I have found is not far from Paul's one but it tells the browser to use your Internet Explorer version which solved other problems I have with content="IE=8".

Here it is:

<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
Dorthydortmund answered 17/2, 2012 at 14:14 Comment(1)
This seems to be the same for IE8 and IE. I tried your suggestion and it fixed it for both I8 and IE9. Thanks.Decorous
M
1

Actually I had the same issue. IE8 has a compatability settings dialog under tools menu. There is a check box which indicates "Display intranet sites in compatability mode". And not that IE7 compatability mode is not the same as using ie7, there are some differences.

Marleen answered 14/3, 2011 at 7:2 Comment(0)
G
1

One side note to this issue: if the same page renders differently on different servers but in the same IE8 browser, check your url - IE8 automatically displays in compatibility mode if the domain is not fully qualified.

Grouchy answered 8/4, 2011 at 15:7 Comment(0)
I
0

If the page content is the same then compare the headers that the servers are sending with the page.

After kicking this around a bit I though about compatibility mode. Try manually forcing IE8 to render the page in compatibility mod. If the render doesn't change then you know that the issue is because IE is rendering that page in compatibility mode when reading it from that web server.

If the latter is the case look into http://msdn.microsoft.com/en-us/library/dd567845%28VS.85%29.aspx

Isomerism answered 30/10, 2009 at 17:57 Comment(1)
This pretty much nails it, because something has to be different. It's got to be the content or the header.Arman

© 2022 - 2024 — McMap. All rights reserved.