Turn off IE 8 Compatibility Mode for site - javascript

My company uses IE8 as the default browser and by default compatibility mode is set for all intranet sites. I'm building an intranet site that works when compatibility mode is turned off. I'm using reset.css and several opensource javascript programs, e.g. datatables.
What I'd like to do is force compatibility mode off for my site. Is there any programmatic way to do it? I have tried setting the meta values
<meta http-equiv="X-UA-Compatible" content="IE=IE8" />
and
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
to no avail.
What's the most frustrating part is that Chrome and Firefox work great as is.

The <meta> tag has to be the first tag inside the <head>, other than <title> and other <meta> elements.
The X-UA-compatible header is not case sensitive; however, it must appear in the Web page's header (the HEAD section) before all other elements, except for the title element and other meta elements.
http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx#DCModes

These must be the FIRST meta tag on your page. Perhaps that's the issue.

Related

Turn off compatibility mode using JavaScript

I am trying to use JavaScript to turn off compatibility mode
I've tried using the following HTML meta tag
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
The issue with this is my document is being loaded within an iframe, so by the time it gets to my meta tag the browser has already been establish in compatibility mode and my meta tag becomes ineffective
I am also unable to place the meta tag in the main document containing the iframe
It would be very helpful if someone knew how to accomplish this with JavaScript or knew of any other approach to solve this
Unfortunately, that can't be done - it is an IE feature that is not accessible from within the JS runtime

Is it possible to have different meta tag to render CSS and a different meta tag to render javascript?

I have an desktop application which is using ie7 engine to render and now We are updating it to ie9 only.
To get CSS3 support We update existing meta tag <meta http-equiv="X-UA-Compatible" content="IE=7" /> to <meta http-equiv="X-UA-Compatible" content="IE=9" /> and it's working fine.
But an issue application has plenty of java script file which written based on ie7 render engine, that's why it's throwing many run time errors. it'll take a lot of time to fix.
So, Is there any way which can force all java script to use ie7 meta or engine while rendering?
Any help would be much appreciated...

IE - Prevent compatibility mode in an Iframe

Is it possible to disable the IE compatibility mode from within an Iframe?
If I use the following meta in the iframe html, this not working:
<meta http-equiv="X-UA-Compatible" content="IE=11; IE=10; IE=9; IE=8; IE=7; IE=EDGE" />
It depends on if you have access to the x-ua-compatible meta of the host (parent). When the host page is at IE9 mode or above, its state is imposed on the iframe. Here's a good explanation, given by a moderator at MS-Connect.https://connect.microsoft.com/IE/feedback/details/1047106/when-webpage-emulates-ie-5-embedded-iframe-shows-ie-8Here's supplemental info about how Quirks mode forked two ways beginning with IE10.https://msdn.microsoft.com/library/hh869300(v=vs.85).aspxHere's a live demo which allows changing the IE modes on-the-fly.It was patched to also allow selecting the iframe url.https://googledrive.com/host/0B8BLd2qPPV7XfnZQRk1JSkg5cFVMbGI1QkZVclVBbUtWZnV2bmczUHpSaVJmSXBOdUg2ek0/toggle-IE-compat-and-quirks-modes.html

Can I turn on IE 10 Compatibility View using JavaScript or HTML?

How can I turn on IE 10 Compatibility View programmatically in Javascript or HTML?
I just added the following meta tag within the <head> tag, but it is not working.
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE7" >
Is there any way to do the same thing in JS?
I checked the compatibility mode article on msdn - here.
Your meta tag is still the method for enabling compatibility mode in IE 10 and IE 9.
As long as you have:
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<!-- Other meta tags etc. -->
<head>
Then it should work. You could try making the http-equiv value case sensitive (at the moment you've set it to lowercase).
Also, to answer your question about JS, you can detect whether the browser is in compatibility mode by comparing the browser engine with the browser version for IE. However, this involves browser version detection, which tends to be a bit unreliable. Also, there isn't a way for you to set the user's compatibility mode in JS. So, for the moment at least, you'll have to stick with the meta tags.
I hope this helps.
A good plugin to allow you to view http header information is IEhttpheaders. Just download it from that link & install. Then, when you start IE, go to the tools menu and select 'DisplayIEhttpHeaders...'. When you visit your site it will list the header response. If you modify your answer to include the response, then we can see if it's the problem.
You say “I just added the following meta tag within the header tag”. Do you mean:
The <header> tag
The <head> tag?
The x-ua-compatible meta tag does need to go inside the <head> tag, not a <header> tag.

How to fix Document mode restart in IE 9

I have a problem with opening my website in IE9. When I try to open my site I get this error in dev tools:
HTML1113: Document mode restart from Quirks to IE9 Standards
I googled and found an answer that suggested to use this:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
or
<meta http-equiv="X-UA-Compatible" content="IE=IE9" />
...but these do not work and I get the following message this time:
HTML1115: X-UA-Compatible META tag ('IE=Edge') ignored because document mode is already finalized.
What is my problem? I read several articles like IE’s Compatibility Features for Site Developers by Microsoft and traced my site with Determining IE9’s Document Mode flowchart and use all suggestions relating to !doctype on these sites but no-one could solve my problem and my IE engine reset after the page opened.
I develop my site with ASP.NET 4 on Windows Server 2008.
How can I fix this issue?
One solution that should always work is to put your X-UA-Compatible in HTTP headers. Also, your <!DOCTYPE> should be specified at the top of your HTML document (<!DOCTYPE html> is the easiest one).
If you put your X-UA-Compatible declaration inside the meta tag you can run into the following problems:
X-UA-Compatible is ignored unless it's present inside the first 4k of you page. If you put it somewhere in the bottom of your head section (or in the body) move it to top. The best place for it is right after encoding and language declarations.
X-UA-Compatible is ignored if it's put inside IE conditional comments. For example:
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
In this case you should remove conditional comments.
Also, you shouldn't have any text before the doctype declaration. If you've got any HTML comments there, for example, the IE will switch to quirks mode.
Finally, check if you're viewing this site from the intranet. By default Compatibility View is enabled for Intranet sites.
I suggest set X-UA-Compatible header for you page and then see if your site is still switching to quirks mode. In that case you should check your markup and try to fix any HTML validator errors until it's back to Standards Mode.

Categories