Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 725
Jedidja Avatar asked Oct 30 '09 17:10

Jedidja


4 Answers

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.

like image 173
Paul Hammond Avatar answered Oct 20 '22 10:10

Paul Hammond


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" />
like image 36
Sebastien Morin Avatar answered Oct 20 '22 10:10

Sebastien Morin


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.

like image 1
Jeff Sinclair Avatar answered Oct 20 '22 09:10

Jeff Sinclair


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.

like image 1
Craig Burlingame Avatar answered Oct 20 '22 11:10

Craig Burlingame