1
votes

I am using compatibility mode in IE11. I am using below code to set compatibility mode:

<meta http-equiv="x-ua-compatible" content="IE=8">  

Now when I run my webpage some of functionality is breaking. After setting User Agent String to 'Internet Explorer 8' everything works fine. This means user agent string is not setting up correctly in compatible mode.

Now question is how I can force my code to use IE8 user agent string. I put the debug point in code and checked navigator.useragent property, it shows IE8 User agent string but in Fiddler it shows IE11 user agent string.

I am confused why its not using IE8 UA in compatibility mode. I am working on changing code to make compatible with IE11 but it may take time. So found using x-ua-compatible might be quick solution. Please advise.

Thanks in advance.

1
what part of your code is breaking? can you share some - securecodeninja
there is one url to lauch some applications from server. If I am passing IE8 User agent string then it works fine. Those applications downloads some dll's. I dont have access to them. Can we able to set User Agent string dynamically?? If I am using compatibility mode IE8 then which User Agent string IE11 should pass? - Nalu
Do I need to add any additional tags for compatibility mode? - Nalu
The compatibility mode changes the document mode, e.g. the mode used to render the page. It does not affect the user-agent string. You'll want to look at Enterprise mode if you're looking to change the user-agent string. To learn more, see blogs.msdn.com/b/ie/archive/2015/04/23/… - Lance Leonard
Thanks for reply Lance. I am little bit confused on USer agent string side, in code if display navigator.useragent then it shows correct one as IE8 but in fiddler it shoes IE11 User agent string. - Nalu

1 Answers

0
votes

The emulation of IE8 in Internet Explorer 11 is broken. Setting the mode using <meta http-equiv="x-ua-compatible" content="IE=8"> is a stopgap measure. Enabling compatibility view for your site may help. Most issues are with CSS and JavaScript, in particular with rollover and dropdown menus.

You have the correct solution: Pull out IE8 specific / broken code and recode for modern browsers.

Microsoft have specifically changed the user agent string to move programmers away from user agent sniffing. Microsoft believes that code should be written to detect features not browser versions.

Starting with Windows Internet Explorer 8, the version token reported in the user-agent string might not reflect the actual version of the browser. If Compatibility View is enabled for a webpage or the browser mode is set to an earlier version, the version token reports the earlier version.

"How I can force my code to use IE8 user agent string." This depends on how your code is being called and where and how the problem happening. IE will only honor x-ua-compatible if it is the first tag after or . Forcing IE8 mode in IE11 does not magically solve problems due to IE11 not correctly emulating IE8.

One option is not to use IE11. Staying on IE10 avoids many problems. Another option is to use a different browser - A Firefox or Chrome based browser works far better than IE11.

Related:

Note that IE11 on Windows 10 is different to the IE11 on Windows 7 and 8. Windows 10 will come the new Edge browser.