简体   繁体   English

打开兼容模式时如何确定正确的浏览器版本

[英]How do I determine the correct browser version when compatability mode is turned on

I need to determine which version of browser the user is using, however compatibility mode is turned on by default for the entire company.我需要确定用户使用的是哪个版本的浏览器,但是默认情况下,整个公司都打开了兼容模式。

On the server side script, how do I determine the real browser version?在服务器端脚本上,如何确定真正的浏览器版本?

Thanks谢谢

Update I've got my page correctly showing the IE version using document.documentMode, however I can't figure out how to pass this over to the server side so I can use it.更新我的页面使用 document.documentMode 正确显示了 IE 版本,但是我不知道如何将它传递到服务器端以便我可以使用它。

Request.Browser will give you complete browser information, where you can check version, browser name, browser type etc. Request.Browser将为您提供完整的浏览器信息,您可以在其中检查版本、浏览器名称、浏览器类型等。

Request.Browser.Version // Return complete browser version infor
Request.Browser.Browser // If browser is IE then it will return **IE**

document.documentMode in javascript was the solution. javascript 中的 document.documentMode 是解决方案。

<script>
alert(document.documentMode);
<script>

Use HttpContext.Current.Request.UserAgent on server if on client then user navigator.userAgent and then instructions from below ie7 has no trident keyword but ie8 is trident/4 and IE5 is trident/5.在服务器上使用 HttpContext.Current.Request.UserAgent 如果在客户端然后用户 navigator.userAgent 然后来自 ie7 下方的指令没有 trident 关键字,但 ie8 是 trident/4 而 IE5 是 trident/5。

First look for MSIE xx, if xx is 7 then look for Trident/yy If trident is missing then it IE7 if yy is 4 then its IE8 and if yy is 5 then ie9 and if yy is 6 then ie10首先查找 MSIE xx,如果 xx 为 7 则查找 Trident/yy

http://blogs.msdn.com/b/ie/archive/2010/03/23/introducing-ie9-s-user-agent-string.aspx http://blogs.msdn.com/b/ie/archive/2010/03/23/introducing-ie9-s-user-agent-string.aspx

Rather than fighting compatibility mode, you can turn it off for your specific web application.您可以为特定的 web 应用程序关闭它,而不是与兼容模式作斗争。 We do this on all of our sites because compatibility mode really screws a lot of things up.我们在所有网站上都这样做,因为兼容模式确实搞砸了很多事情。

Force IE compatibility mode off using tags 使用标签强制关闭 IE 兼容模式

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

相关问题 如何确定设备是否为桌面浏览器? - How do I determine if a device is a desktop browser? 如何确定我是否刚刚计算了正确方向的法线? - How do I determine if i just calculated the normal in the correct direction? 如何确定何时显示工具提示? - How do I determine when to show a tooltip? 如何在未插入设备时确定设备驱动程序的版本? - How can I determine the version of a device driver when the device is not plugged in? 创建 class 时如何确定它的实例化名称 - How do I determine the instantiated name of a class when I create it 如何确定ASP.Net中上载图像的颜色模式 - How do I determine the colour mode of an uploaded image in ASP.Net 如何确定何时无法在NetworkStream中读取数据? - How do I determine when there is no more data to read in a NetworkStream? 当只有一个图钉时,如何确定 Bing 地图的正确缩放级别? - How can I determine the correct zoom level for Bing Maps when there is only one pushpin? 如何确定Office版本号的JavaScript API(适用于Office 2013项目的应用) - How do I determine JavaScript API for Office Version Number (App for Office 2013 Project) 如何从C#桌面应用程序以全屏模式打开默认浏览器? - How do I open default browser in fullscreen mode from a C# desktop application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM