Dzermin Cosovic
Dzermin Cosovic

Reputation: 43

Make IE 11 user agent string IE 9

I've got an old IE adapted site using a grid component which refuses to work with anything but IE 11 using IE 9 user agent string mode (i.e. the browser pretends to be IE 9 without emulating 9 behaviour if I've unverstood correctly). Due to budgeting constraints I'm not able to change this black box component and I'd prefer not to have the user turn on their agent string mode explicitly in their developer tools: is it possible for the site to make IE 11 choose a user agent string for IE9 without using developer tools?

Upvotes: 0

Views: 3691

Answers (1)

Dzermin Cosovic
Dzermin Cosovic

Reputation: 43

I stumbled on a property on my page which effectively changes the user agent string used by the browser. The code would be something like:

Page.Master.Page.ClientTarget = "ie9";

And in the web.config file I've added an alias:

<clientTarget>
 <add alias="ie9" userAgent="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" />
</clientTarget>

The string is borrowed by setting the UA string in IE 11 to IE 9 mode and then copying it from the request header.

The idea originates from: http://msdn.microsoft.com/en-us/library/system.web.ui.page.clienttarget%28v=vs.110%29.aspx

Upvotes: 1

Related Questions