Force Browser and Document Mode to ie9 in ie10 - asp.net

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" />

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>

Icons missing on Azure Wordpress site

I created a WordPress Azure Website through the Azure Websites Gallery. I installed a theme called Bridge.
Everything is working quite fine...Except, I have no icons appearing on the desktop version of my site (through Chrome, Firefox and IE). I am seeing icons on my Windows phone. I am not seeing icons on the desktop site when I squeeze the window down to mobile phone size.
To give you some background to where this problem is potentially coming from…
I have used a custom domain. To make the WordPress site work with a custom domain, I have added this code to the wp-config.php file:
/*Emma added the below to fix permalink to be custom domain*/
define('WP_HOME','http://examplesite.com');
define('WP_SITEURL','http://examplesite.com);
The code above meant that once you clicked on a post or page and moved away from the homepage, the url was still examplesite.com/pagename instead of examplesite.azurewebsites.net/pagename.
So back to the icon issue…
The icons are displayed through using a font (font-awesome to be exact). I have the latest updates of the theme and the latest 4.2.0 version of the font is in the font files. The font files can be found here in my site:
wp-content > themes > bridge > css > font-awesome > fonts
I asked the Bridge theme team why the icons were not displaying. They replied:
This is happening because of cross-origin access is denied for your site. You should paste this code to htaccess file that is located in
WP installation directory:
<ifModule mod_headers.c>
Header set Access-Control-Allow-Origin: http://examplesite.com
</ifModule>
I do not have an .htaccess file because my site is running on Azure. From what I understand .htaccess files are linked to Apache. Instead of a .htaccess file, I have a web.config file and a web-config.php file because I installed this from Azure.
I created a .htaccess file in the root of my website and pasted the above code. Of course that didn’t work. I also looked up how to write the web.config version of the code and pasted that into the web.config file and that did not work (although with my little knowledge of this area, the syntax is probably wrong) and that didn’t work. See the code below:
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="http://examplesite.com" />
</customHeaders>
</httpProtocol>
I also added this to the web.config file and that hasn't worked:
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
I have read that I need to also change the buildAction to "content", but not sure how to do that as when you click properties of files such as .woff, you don't seem to get that option.
I also played around with adding something to the web.config.php file under the custom code I wrote to get my domain to work, but that didn’t work either. Once again, not sure my code was correct.
I went back to the support team at the Bridge theme and they said that I should contact my hosting provider to do this for me because .htaccess can’t work on this type of server.
So, now I am not quite sure what to do.
Does anyone know the correct code I should put into my web.config, web-config.php or other file? Or, is there another issue here I am not understanding? Perhaps something as simple as adding something to the custom css to call to the font?
I wonder if there is a clue in the statement I made above...
"Everything is working quite fine...Except, I have no icons appearing on the desktop version of my site (through Chrome, Firefox and IE). I am seeing icons on my Windows phone. I am not seeing icons on the desktop site when I squeeze the window down to mobile phone size."
If I can see them on my phone, then surely that means at some point the icons are being rendered correctly?
I have had a look through my css files for a change in a way the site is rendered through media queries, but didn't find anything there either.
After many hours of searching for a solution I found this post: Windows Azure CDN and *.woff fonts
I copied this code into my web.config file as a child of system.webserver:
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="HEAD,GET,OPTIONS" />
</customHeaders>
</httpProtocol>
That seemed to solve it! :)
Have tested in Chrome, FireFox, IE and mobile and all icons are now showing. Magic!

Internet Explorer compatibility mode

I have a ASP.NET web application which is supposed to work on IE.
If I go to compatibility View Settings and uncheck Display intranet sites in Compatibility View and the domain is not added in the box Websites you've added in Compatibility View, the users sees the code not the forms of the page.
If I check the checkbox, he still sees the code, only after I add it in the box I can see the actual forms of the page.
I tried
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=IE5" />
</customHeaders>
</httpProtocol>
</system.webServer>
but still the same problem.
Is there another way to force it from code? I understand in the future the checkbox will be disabled so I must find I way to force the compatibility mode.
Can I add it to the box for Compatiblity View from code?

Compatibility problems with Internet Explorer 10/11 and an old .net framework 1.1 website

The Scenario
I have a very old website developed in .net (framework 1.1). The site has several problems with Internet Explorer 10/11 that can be fixed using compatibility view.
The Problem
Problem is that framework 1.1 doesn't recognize Internet Explorer 10/11 as an advanced capability browser, so a lot of features (for example javascript code) are disabled when a user with Internet Explorer 10/11 accesses the website.
Microsoft released patches to fix this problem for .net framework versions >=2.0 but not for framework 1.1.
What I already tried
I tried forcing IE7 Compatibility Mode in web.config or adding HTTP Header in IIS or directly inside html pages with:
<meta http-equiv="X-UA-Compatible" content="IE=7" />
but this is not a valid solution, since javascript code is still missing due to the 1.1 framework issue.
The only working solution I found is manually setting Compatibility View in the browser, but some of my customers have problems activating Compatibility View since they don't have confidence with PCs.
My two cents
I know that probably the best solution would be to convert the entire project to a newer version of the framework (>=2.0), unfortunately the project is huge and its conversion would be very complex (the solution includes a lot of other projects, older classic ASP sections, Crystal Reports reports and so on...)
The real question
Is there a solution that doesn't require project conversion or manual operations from end user?
edit the web.config file and in the <system.web> section add
<browserCaps>
<case match="IE[ /](?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
browser=IE
version=${version}
majorversion=${major}
minorversion=${minor}
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
activexcontrols=true
ecmascriptversion=1.5
vbscript=true
backgroundsounds=true
isMobileDevice="true"
<filter match="[4-9]" with="${major}">
ecmascriptversion=1.3
css1=true
css2=true
xml=true
<filter match="[5-9]" with="${major}">
w3cdomversion=1.0
</filter>
</filter>
<filter match="^b" with="${letters}">
beta=true
</filter>
</case></browserCaps>
First: The X-UA-Compatible tag has to be the very first tag in the < head > section.
Try using the emulate option, which allows quirks mode:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
Also, completely removing a "DOCTYPE" from your page has also been known to help force compatibility mode or putting something like an xml declaration at the top
<?xml version="1.0" encoding="UTF-8">
just try to configure the IIS for this -
Add the custom HTTP response header in IIS
To add a custom HTTP response header at the Web site level, at the folder level, or at the virtual directory level in IIS, follow the steps for the version of IIS that you are using.
IIS 7 on a Windows Server 2008-based Web server
Start IIS Manager. To do this, click Start, click Run, type inetmgr,
and then click OK.
Under Connections, double-click the server that you want, and then
double-click Sites.
Click the Web site, the folder, or the virtual directory where you
want to add the custom HTTP response header.
Under Home, double-click HTTP Response Headers in
the IIS section. Note The placeholder refers to the
name of the Web site.
Under Actions, click Add.
In the Name box, type X-UA-Compatible.
In the Value box, type IE=EmulateIE7.
Click OK.
IIS 6 and earlier versions
Click Start, click Run, type inetmgr.exe in the Open box, and then
click OK.
Expand the server that you want, and then expand Web Sites.
Right-click the Web site, the folder, or the virtual directory that
you want, and then click Properties.
On the HTTP Headers tab, click Add under Custom HTTP headers.
In the Custom header name box, type X-UA-Compatible.
In the Custom header valuebox, type IE=EmulateIE7.
Click OK two times.
for more detail please see this link
I managed to find a solution: basically I retarget my application to run under Framework 4.0 while the application is still compiled with Framework 1.1.
To accomplish this I followed this MSDN page. Here's an excerpt:
You can retarget the application to run under .NET Framework 4. Retargeting requires that you add a element to the application's configuration file that allows it to run under .NET Framework 4. Such a configuration file takes the following form:
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
So my problem is solved in 2 steps:
add this section to the web.config file of the Framework 1.1 web application:
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
in IIS create a new application Pool and configure the old Framework 1.1 web application to run with Framework 4.0 in the newly created pool
Now the application runs under Framework 4.0 therefore new browsers are correctly recognized and advanced features are available.

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