1

I came across multiple blogs about using meta tag to change rendering mode/version of internet explore as IE9 or 10 are combination of multiple browsers.

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

But for me this tag seems to be working only in full Internet explorer browser only, but not in .net browser control. Am I correct in my observation?

I have to override default browser version (from 7 to 8) picked by browser control. Changing/adding registry parameter is not an option.

Manish
  • 1,452
  • 15
  • 25
  • Why exactly is "adding registry parameter" (specifically `Feature_Browser_Emulation`) not possible? That's the proper way to fix this. – EricLaw Sep 10 '13 at 21:36
  • EricLaw, adding registry parameter is possible but not an option, customer don't want any kind of manipulation in registry. – Manish Sep 11 '13 at 06:30

2 Answers2

2

This meta tag works correctly only if this is the first element in the <head> section.

tpolyak
  • 1,234
  • 1
  • 9
  • 15
  • tpolyak, have you ever tried this, as meta tag doesn't seems to be working for me in .net web browser control, it only works in Internet explorer browser. Meta tag is a very first line in ` – Manish Sep 11 '13 at 07:21
1

If you specify the X-UA-Compatible value via the META tag or HTTP response header, the document mode will change to the value specified, just like in Desktop IE.

Unlike changing the browser mode using the F12 Developer Tools, the document mode does not impact the User-Agent string sent to the server. In fully-patched versions of IE, the X-UA-Compatible setting does impact the User-Agent shown to JavaScript in the navigator.userAgent property, although that value is unchanged if the document mode setting is changed using the F12 developer tools.

You can explore the results of sending X-UA-Compatible by viewing

http://webdbg.com/ua.aspx

and

http://webdbg.com/ua9.aspx

The first page does not specify a document mode (and thus gets the default) while the latter specifies the document mode is IE9. If you click the Document mode link, you can see that the document's mode is sensitive to the X-UA-Compatible directive, even if the User-Agent in the request headers is unchanged.

In contrast, to change the browser mode of the Web Browser control within your application, you must set the FEATURE_BROWSER_EMULATION registry key, specifying the name of your executable and the desired mode.

A customer requirement that "no registry changes may be made" is goofy. It's reasonable to say: "We don't want any registry manipulation that would impact IE or another program." It's unreasonable to say: "We don't want any registry manipulation at all" considering that the mere act of running your executable results in changes to the registry.

EricLaw
  • 56,563
  • 7
  • 151
  • 196
  • +1 and @Manish, you don't need admin rights to the registry for this to work, `HKEY_CURRENT_USER` hive is enough, [example](http://stackoverflow.com/a/18333982/1768303). – noseratio Sep 24 '13 at 07:13
  • I found this false. Setting the X-UA-Compatible to IE8 does render an IE8 user agent if you access it via JS navigator.userAgent (not server side) – Shane N Mar 14 '14 at 20:57
  • 1
    @ShaneN: I've clarified this answer a bit. – EricLaw Mar 17 '14 at 17:53