1

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.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
Nalu
  • 1,107
  • 4
  • 20
  • 43
  • what part of your code is breaking? can you share some – securecodeninja Apr 23 '15 at 19:27
  • 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 Apr 23 '15 at 19:37
  • Do I need to add any additional tags for compatibility mode? – Nalu Apr 23 '15 at 19:48
  • 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 http://blogs.msdn.com/b/ie/archive/2015/04/23/announcing-improvements-to-enterprise-mode-and-enterprise-site-discovery.aspx – Lance Leonard Apr 24 '15 at 19:48
  • 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 Apr 24 '15 at 21:30
  • Yeah, those differences are intentional and stem from earlier versions of IE. At one time, you could use Registry settings to change the UA string and those changes would be reflected in both places. However, this led to very long UA strings that in turn caused problems for the browser and some servers. Thus, the browser was updated to show a smaller UA string during HTTP negotiation and the larger one for the navigator property. See http://blogs.msdn.com/b/ieinternals/archive/2009/10/08/extending-the-user-agent-string-problems-and-alternatives.aspx for more details. – Lance Leonard May 01 '15 at 17:40

1 Answers1

0

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.

Community
  • 1
  • 1
Underverse
  • 1,271
  • 21
  • 32