IE9 throwing site to Quirks mode - asp.net

I want to avoid that. I've tried:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
(from HTML5 doctype putting IE9 into quirks mode? )
And:
<meta http-equiv=”X-UA-Compatible” content=”IE=9″ />
(from Disable quirks mode for parent frame )
But neither helps. When I do F12 - Document mode IE9 standards - the page is shown fine.
Any solution?

If the page is local, or on an Intranet , Internet Explorer defaults to quirks mode.
If you put the same page on The Web, it would behave as expected.
To get it working as you want, as you are using ASP.NET, you can add this to your web.config file:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
This avoids having to override the user settings for all Intranet pages.

I was running the page locally and having this issue. I was using HTML5 and just starting my page with <html>.
When I added <!DOCTYPE html> it magically started working (even locally).
In context:
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<add name="X-UA-Compatible" value="IE=edge" />
</head>
More info about IE8 and doctype.

Related

Asp.net web page force document mode edge in IE?

I have a webpage that is not working properly in IE unless I hit F12 and change the document mode to "Edge" under emulation. Is this something I can do programmatically on the page so the user does not have to do this? TIA
You could try adding the X-UA-Compatible META tag. This belongs in your <head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
Internet Explorer allows you to define which version's engine is used to render a page using the X-UA-Compatible META tag or HTTP header. A specific version can be designated or the latest version using the 'IE=edge' value.
You can also add custom HTTP headers in the ASP.NET web.config:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

external page and iframe issue

I have 2 websites hosted on windows server 2012. One website is using asp.net while other is wordpress. I want to embed asp.net page in wordpress. But, it is not showing anything. I did some research and came to know that perhaps, I have to allow permission for external website. Please guide me how to do it, should I add anything in web.config? I added below in asp.net but it did not help
<head>
<meta http-equiv="X-Frame-Options" content="allow">
</head>
Please guide, how to allow external website in iframe?
The iframe looks like below:
[iframe mydomain.com/signIn.aspx 640px 400px]
Thanks
You can do it in your web.config (if hosted on IIS 7.0 or later):
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Frame-Options" /> <!-- optional -->
<add name="X-Frame-Options" value="ALLOW" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
This must be added in the application being "framed" (in your case an asp.net app), not in the parent app (wordpress).
Reference: https://www.iis.net/configreference/system.webserver/httpprotocol

Asp.net website compatibility with IE 11

I have an old asp.net intranet website.. I have been using IE 8 till now without any issue. Now I am trying to check if it works well with IE 11. I see that there is no problem with the site when requesting the page from IE 11 from my desktop.
But when I try to debug the same website locally in VS the controls are out of place and even fails to detect the IE Browser by
if(window.ActiveObject) which seems to be correct behaviour for IE 11.
Now I am wondering how the intranet website looks perfectly fine in IE 11. The server is Windows server 2008 IIS 7.
Any suggestion.
The window.ActiveXObject property is hidden from the DOM starting from IE11 so, you can no longer use it.
http://msdn.microsoft.com/en-us/library/ie/dn423948%28v=vs.85%29.aspx
In VS, it happens often to see the markup misaligned whenever in designer mode. But I think you should care less about that and focus more on the code markup instead
In the web config file you can use the customHeaders tag:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<httpRedirect enabled="false" />
<httpProtocol>
<customHeaders>
<remove name="X-UA-Compatible" />
<add name="X-UA-Compatible" value="IE=EmulateIE7" />
</customHeaders>
</httpProtocol>

Force Browser and Document Mode to ie9 in ie10

This code:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
seems to only change document to ie9 and not browser. Any ideas other than hitting F12 and changing it manually?
A site can not set the Browser mode. The browser mode is chosen before the browser requests content from the site. This specifies how the browser is identified to the site, such as the UA string.
As you mentioned, the Document mode can be set by the author by including a X-UA-Compatible meta element, or by the DOCTYPE used. This overrides the default set by the browser for that browser mode.
Changing the Browser Mode is only useful for using IE to test how an earlier version of IE would handle the site. You can change it on your local machine (but not for the site as a whole) by changing it in the F12 tool.
The user (and thus developer) can change the Browser mode by clicking on the Compatibility View icon in the URL field. This will also be only for that machine, and not for all users.
The only way to change the Browser mode globally is to get the site added to MS’ Compat View List. But you don’t want that unless the site uses a ton of old MS vendor specific code, and will not be updated.
You can read more at http://blogs.msdn.com/b/ie/archive/2010/10/19/testing-sites-with-browser-mode-vs-doc-mode.aspx
Optionally, you can alter the Web.config file to accomplish this as well. (You'll have to restart the service after publishing to see the changes.)
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=Edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
You can use the FEATURE_BROWSER_EMULATION feature of Internet explorer.
Start regedit.exe, go to
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
or
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
create a DWORD iexplore.exe and set the value to 9999 (0x270F).
see this.
you can force highest mode by adding:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Setting headers to override IE intranet compatibility mode in ASP.NET

I have an intranet site that loads in IE7 compatibility mode, unless the user has unchecked "Display intranet sites in Compatibility View" on their version of IE8. Unfortunately, the client wants this checked for other sites that they use, so I need to override this setting. I've tried the meta tag,
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
but it does not override the browser setting. However, this question indicates that a server heading will indeed override. This is the example code given in the top answer:
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
I've opened up web.config and put it in <system.webServer> but it doesn't work. I'm watching the headers with fiddler but it isn't adding the header at all. (Also, it still is forced to compatibility mode and Javascript confirms documentMode is 7.) I'm working locally with the ASP.NET Development Server
The <system.webServer> tag is specifically for IIS (7, I believe). It won't affect the Cassini server that Visual Studio uses in-house. If you only need to worry about this issue in a live dev environment, try testing on an instance of IIS. Otherwise, you may want to try IIS Express in development.

Resources