How to turn on IE9 Compatibility View programmatically in Javascript

时间:2014-03-28 12:40:56   收藏:0   阅读:567

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:

  1. 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.
  2. 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.
  3. 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

原文:http://www.cnblogs.com/happy-Chen/p/3629161.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!