Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force IE9 into browser compatibility view

I am aware of how to force IE into viewing a page in document compatibility, but what about browser compatibility view?

I have a project that only works when IE9 is in browser compatibility view for various reasons, yet I can't find any resources on how to force IE9 to do so.

Everyone only talks about forcing the document compatibility, e.g. using

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

But that doesn't work in my case, because it only sets the document view. Is there a way to set the browser view, too?

PS: To make it abundantly clear, this is the setting I need to enforce:

Browser Compatibility

like image 364
F.P Avatar asked Jul 17 '12 09:07

F.P


3 Answers

See MSDN documentation.
You should use emulateIE7 since compatibility mode is kind of IE7:

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

Edit

If the above does not work, the other options are really poor.
Quoting from the link above:

  • Microsoft has not placed the domain name of the site on a blacklist. (blacklist linked in original article is very old and not being updated, you can find a local copy on your computer)
  • An intranet admin has not placed the site on a blacklist.
  • The user has not pressed the Compatibility View button (duh)
  • The site is not in the intranet zone
  • The page is not framed by a Compatibility Mode page.

The above are, AFAIK, the only causes for compatibility mode.
Unless you are prepared to contact Microsoft directly to have your website added to the global blacklist, there isn't much you can do (unless you want to wrap your site in a frame that originates from a blacklisted domain).

like image 51
Razor Avatar answered Oct 21 '22 11:10

Razor


I've tried the various methods suggested by the MSDN article at http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx regarding forcing IE9 to emulate a previous version with the X-UA-Compatible header in order to display correctly.

In my case, the test is playing an MP4 video file in an IE9 browser which is using the default standard mode rather than the compatibility mode. Other websites have said that Internet Explorer is only configured to play MP4 files (rather than ogg and webm video files), so I assumed that would be the safest file format to test.

I had tested the view of the webpage using IE9 emulating the IE8 standard and the IE7 standard views of that page, and in both cases, the old standard views worked for playing the MP4 video file. And the IE9 compatibility mode also played that web page. But I forced the IE9 to revert back to the standard view in order to test a code that would work for playing the video for those who had not configured their own IE9 browser to use compatibility mode.

The methods suggested by that MSDN article referenced earlier seem to be directed towards this issue, but in testing each of those methods, none of them fixed the problem of an IE9 browser playing an MP4 video file.

The solution to my problem came from this Stack Overflow ticket: HTML5 Video not working only in IE9

I actually had to add the following lines to the .htaccess file on the website:

AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/mp4 .mov
AddType video/webm .webm

Then, I also needed to make sure that the first line of code used this:

<!DOCTYPE html>

... rather than this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

I did not need to use any of the "previous version" code such as this:

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

On my test page, I also used the video-js code, which I had assumed would take care of the IE9 standard problem (as it had for other web browsers). Its own code seems to have also output the following X-UA-Compatible codes:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

However, these codes alone did not solve the problem. Ultimately, I believe it was due to the addition of the code to the .htaccess file.

like image 22
Bryce Morrison Avatar answered Oct 21 '22 12:10

Bryce Morrison


I have one solution for all (7,8,9) ie Browsers

<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js" > </script>

use this java script in head tag.

like image 1
Kesar Sisodiya Avatar answered Oct 21 '22 10:10

Kesar Sisodiya