1

On my developer machine an ASP.NET MVC 3 application si working perfectly (IE9, Firefox) but on the production server when I open it in IE9 some parts of the JavaScript code and CSS (for example border-radius) do not come into IE9. I suspect the IIS because on development machine on localhost IE9 it works well. The server version (Win 2008 R2, IIS 7.5) and IE are the same on the both computer. What can be the problem, please?

4

3 回答 3

4

This is almost certainly nothing to do with IIS. What is likely happening here is that IE9 is being too clever for its own good.

IE has a config setting that when turned on tells the browse to fall back to IE8 compatibility mode when you load a site in the local intranet.

The idea of this setting is to make it easier for corporates with dodgy internal web applications to upgrade to IE9, because in theory their internal sites will continue working in IE8 mode.

That's the theory. In practice, it was a bad idea for a number of reasons.

The really bad part is that the setting is switched on by default.

Most users never notice, because most people don't develop their own sites. But for web developers, it can be a really annoying feature, because "internal intranet" includes localhost. I recommend you find the setting, and switch it off.

Virtually no-one else is going to be affected by this even if they're using IE9 with the flag still switched on, because they won't be loading the site from localhost as you are.

It is possible that some users may have their browser set to always show compatibility mode (I can't imagine why they would, but it's possible). For these users, it's helpful to add the following line of code to your <head> section:

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

This tells IE to always use the best rendering engine it has available (so IE9 will be in IE9 mode). This will deal with other users. However, for yourself, I think you may still need to switch the flag off manually in your settings, because if I recall correctly, that local intranet setting overrides the X-UA-Compatible header.

Hope that helps explain things.

于 2012-10-27T21:14:11.317 回答
2

IIS and ASP.NET have nothing to do with how your CSS renders, so don't worry about that.

For IE9 to render them differently, my guess is that one of them is using a different mode. Hit F12 to get to developer tools, and you'll see two options to change the mode from IE7, IE8, IE9, and I think quirks mode or something like that. Make sure both are set to IE9, and you should see the proper CSS stuff.

于 2012-10-27T21:05:14.307 回答
2

Border radius should be rendering correctly on IE9. You might be missing this in your page header

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
于 2012-10-27T21:05:40.970 回答