首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Javascript检查兼容性视图是否处于打开状态

Javascript检查兼容性视图是否处于打开状态
EN

Stack Overflow用户
提问于 2011-04-07 20:27:55
回答 2查看 1.7K关注 0票数 1

如何使用Javascript检查兼容性视图是否打开?

不管是哪个版本的IE,我只需要知道兼容性视图是否打开。

EN

回答 2

Stack Overflow用户

发布于 2011-04-07 20:37:29

Determining Document Compatibility Mode

代码语言:javascript
复制
engine = null;
    if (window.navigator.appName == "Microsoft Internet Explorer")
    {
       // This is an IE browser. What mode is the engine in?
       if (document.documentMode) // IE8 or later
          engine = document.documentMode;
       else // IE 5-7
       {
          engine = 5; // Assume quirks mode unless proven otherwise
          if (document.compatMode)
          {
             if (document.compatMode == "CSS1Compat")
                engine = 7; // standards mode
          }
          // There is no test for IE6 standards mode because that mode  
          // was replaced by IE7 standards mode; there is no emulation.
       }
       // the engine variable now contains the document compatibility mode.
    }
票数 1
EN

Stack Overflow用户

发布于 2011-04-07 20:33:02

前段时间偶然发现了这篇博文。也许这就是你要找的:http://blog.strictly-software.com/2009/03/detecting-ie-8-compatibility-modes-with.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5580998

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档