1

我一直在网上寻找答案……这是我需要的,但我没有得到。

预告

  • 运行一个 WordPress 网站
  • 使用 IE8 兼容性时网站无法正确加载(9 很好)。
  • 已实施快速修复

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

    乃至

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

    这并不能解决问题。

  • 由于各种原因,我需要一个 javascript 解决方案
  • 这个想法是,当用户打开兼容模式时,会出现一条消息,告诉用户将其关闭。

    我知道这与它有关,但我不知道如何在 javascript 中对其进行编码来做某事。

    IE8 Compatibility View: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0;...)
    
    4

    1 回答 1

    0

    X-UA-Compatible (either meta element or HTTP response header) with IE=edge value reliably prevents user from switching to compatibility mode by clicking button at the right of location bar — since the button is not shown at all when X-UA-Compatible with IE=edge value is present.

    Ability to switch modes via developer tools (opening via F12 key) is not an issue — this is development feature which state does not persist after browser is restarted so is totally safe and is not something to care about.

    However, if page works incorrectly in IE8 compatibility mode, then it very likely works incorrectly in real IE8 too. So if support for IE8 is important for you, you should fix issues related to IE8 itself, not to compatibility-mode feature.

    于 2013-01-03T23:57:21.773 回答