简体   繁体   English

有什么方法可以实用地检测IE11企业模式?

[英]Is there any way to detect IE11 enterprise mode pragmatically?

Is there any way to detect Internet Explorer 11 Enterprise mode pragmatically? 有什么方法可以实用地检测Internet Explorer 11企业模式?

Pragmatically means at server side in csharp or in javascript/jquery. 实用的意思是在服务器端使用csharp或javascript / jquery。

Following thread is still not conclusive 跟随线程仍未定论

IE 11 - Is there a way to check then enable / disable enterprise mode? IE 11-有没有办法检查然后启用/禁用企业模式?

Sending X-UA-Compatible HTTP Header or use a META tag in your page's HEAD will kick IE into a compatibility mode. 发送X-UA兼容的HTTP标头或在页面的HEAD中使用META标记将使IE进入兼容模式。 So not doing so will let it run in normal mode. 因此,如果不这样做,它将使其在正常模式下运行。

If you want to test if the browser is compatible I would write an jQuery AJAX call that tries to use a javascript function that isn't working in older IE inside a try catch and POST the result to your application. 如果您想测试浏览器是否兼容,我会写一个jQuery AJAX调用,尝试使用一个JavaScript函数,该函数在try catch内的旧IE中不起作用,然后将结果发布到您的应用程序中。

for example trim() doesn't work in IE8 例如trim() 在IE8中不起作用

var str = "       Hello World!        ";
var a = (str.trim());
if(a == "Hello World!"){
  //Ajax Post true
} else {
  //Ajax Post false
}

This should work because if enterprise mode is activated it will work inside IE8 这应该起作用,因为如果激活了企业模式,它将在IE8中起作用

http://blogs.msdn.com/b/ie/archive/2015/03/02/making-it-easier-for-enterprise-customers-to-upgrade-to-internet-explorer-11-and-windows-10.aspx http://blogs.msdn.com/b/ie/archive/2015/03/02/making-it-easier-for-enterprise-customers-to-upgrade-to-internet-explorer-11-and-windows- 10.aspx

You can verify the User Agent string Get the user agent string with Javascript : navigator.userAgent; 您可以验证用户代理字符串。使用Javascript获取用户代理字符串: navigator.userAgent;

For IE11 Enterprise Mode on desktop the User agent string will be 对于台式机上的IE11企业模式,用户代理字符串为

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; Tablet PC 2.0)

Refer https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx 请参阅https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM