AFAIK, this is not possible. You can detect the compatibility mode from JS but setting it is not possible to my knowledge.
As for as your problem goes, typically you can use few solutions:
- If you are using Master pages in your site, add the meta header
(
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
) in the master page. - Similar to #1, if you are using a common base page class (a good and recommended practice) then you can infuse the meta header from the common base page to all your pages.
- Lastly, you can use IIS configuration to add the http header to all your response.
For example, for IIS7/IIS7.5, you can use web.config
<system.webServer><httpProtocol><customHeaders><remove name="X-UA-Compatible"/><add name="X-UA-Compatible" value="IE=EmulateIE7"/></customHeaders></httpProtocol></system.webServer>
I would suggest #1 or #2 - in case you don‘t have master page or base page class then perhaps its a good time to introduce the both.
How to turn on IE9 Compatibility View programmatically in Javascript,布布扣,bubuko.com
How to turn on IE9 Compatibility View programmatically in Javascript