ASP.NET Change IE document mode? - asp.net

I've got a problem with an ASP.NET project. It uses .NET Framework 2 (old I know but can't update for other reasons) and when you open the site in Internet Explorer there are some bullet points which do not show. Set-up like:
<ul class="abc"><li>Bullet point 1</li></ul>
However when I open Internet Explorer developer tools by pressing F12 I can change the document mode from "Internet Explorer 7 Standards (Page Default)" to "Internet Explorer 8 Standards" the bullet points show correctly.
How can I change my solution so that all pages are set to use the Internet Explorer 8 standards by default?

Either simply just use <!DOCTYPE html>, or add this to your Web.config:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=Edge,chrome=1" />
</customHeaders>
</httpProtocol>
</system.webServer>
You can also use <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" /> instead of a header, but it causes page redrawing.

Check the doctype. If I remember correctly the XHTML 1.0 strict doctype will enforce IE 7 mode. Also, you can use the X-UA compatible meta tag like so to put it in IE-9 mode: . Essentially, this isn't a function of ASP.Net at all. Your browser determines what engine to use first by your doctype then second by any over-riding features you've told it to use such as X-UA.
More information can be found at: https://msdn.microsoft.com/en-us/library/jj676915%28v=vs.85%29.aspx
The key point to remember with using X-UA is that it must be the very first tag in your . If you put it second it won't work.

Adding this under the DOCTYPE worked.
<meta http-equiv="x-ua-compatible" content="IE=Edge" >
It did not work when that was between the head tags. You can changed edge to 7/8/9 etc to suit.
Haven't tried but you need to have DOCTYPE such as <!DOCTYPE html>

Related

X-UA-Compatible - Including EDGE and IE9?

<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
In the above declaration, would IE 10 be forced to render in IE9? I'm not sure what the EDGE would do as it's at the end of the list?
Ian
It renders in IE10 mode. You can check that by including it in a document and opening the F12 tools to see what mode it renders in (shown in the top bar of the tool), or include a script that checks. E.g. with this document https://dl.dropboxusercontent.com/u/444684/tests/X-UA-Compatibletest.html it returns 10.
Looking at the following documentation, it looks like your meta is actually invalid. There they separate modes by a comma and don't repeat the IE token, e.g. <meta http-equiv="X-UA-Compatible" content="IE=7,9,10" > . It also mentions the highest supported mode will be used, so if you include edge, it will always be edge. In that case you don’t get any benefit of using the additional modes, as they’ll never be used.

How to Conditionally apply Compatibility Mode of Browser to use 7 or 9 in asp.net?

I have a JavaScript which works in IE7, 8 Compatibility Mode, Chrome, Firefox etc. The only thing is this script doesnt work in IE8 and IE9. Any Idea?
So, i would like to set the document compatibility mode during runtime in page ,<Head> section. How to Conditionally set the compatibility modes?
I recommend fixing your JavaScript. In the long run you'll save yourself a lot of trouble.
If your dead set on leaving your script as it is, you can use the X-UA-Compatible meta tag (see META Tags and Locking in Future Compatibility). That should make your JavaScript work (no guarantee!).
If you want to set it at run time you can declare it on your page:
<meta id="comp" http-equiv="X-UA-Compatible" runat="server" />
and set it in the code-behind
comp.Content = "IE=EmulateIE7";
Other browser simply ignore the tag however, so you can just put it on your page like this:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Alignment problems in the Extension Library Application Layout Placebar in IE but not Firefox

Got an interesting CSS problem. The first graphic shows the buttons on the PlaceBar in IE where the "Views" button is pushed up. This button has children if this makes a difference. In FireFox everything lines up perfectly. Does anyone know if this is adjustable in the CSS and if so where?
I've found another fix. Add this to the CSS:
.lotusPlaceBar .lotusBtnContainer {
float: right;
}
You can force IE not to use compatibility mode by using the X-UA-Compatible meta tag to control the version of IE to render the page for.
Add the following meta tag to enable IE8 Standards Mode:
<meta http-equiv="X-UA-Compatible" content="IE=8" >
You can add the meta tag in a theme using:
<resources>
<metaData>
<httpEquiv>X-UA-Compatible</httpEquiv>
<content>IE=8</content>
</metaData>
</resources>

ASP.NET Force IE8 to use IE7 or IE8 Compatability View

I've tried the following and all it does is change the Document Mode, not the Browser Mode:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta http-equiv="X-UA-Compatible" content="IE=7">
My particluar page only works when the browser mode is either IE7 or IE8 Compat View.
The code you posted should work.
Please ensure the following:
The meta tag is right at the top of the header, as first element after the <title></title>.
Restart IE and open your page without manually setting the Browser- or Document Mode from the Developer Tools. Setting these manually can overwrite IE's behavior and causes it to ignore the compatibility tag.

IE not rendering CSS properly when the site is located at networkdrive

This is kinda weird problem we came across with my friend. We located our site at network drive and tried to open it from there. All other browsers render this page just fine but IE (btw. why it's always IE? :) ) can't understand inline-block statement. But if I copy our file to my local drive there is no problem, IE renders everything just like other browsers.
I tested this with IE7-9b.
This sounds like that problem - where IE switches rendering modes depending on where the page is located.
It's insane.
See this answer.
http://127.0.0.1/mysite/mypage.php <-- IE8 by default (updated!)
http://localhost/mysite/mypage.php <-- IE8 by default (updated!)
http://machinename/mysite/mypage.php <-- IE7 by default
http://192.168.100.x/mysite/mypage.php <-- IE7 by default
http://google.com/ <-- IE8 by default
So, because you're accessing your site via "network drive", IE is going into IE7 mode, and IE7 does not support inline-block properly, hence your site does not render properly.
You can request IE8 to render your page in IE8 mode by adding this to your page:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
Or, to request IE8 to use the most recent version of it's rendering engine (think IE9), you should use this:
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
Or, to use Chrome Frame instead if it's available:
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
Use an admin account. IE may Denies access to network drive if not admin.

Resources