且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

服务器端的 Internet Explorer 11 检测

更新时间:2023-11-27 21:51:40

我通过使用下面的正则表达式解决了这个问题,因为我使用了一个淘汰系统来检查正在使用什么浏览器访问网站.

I solved this by using the Regex below after having a knock out system to check what browser is being used to access the site.

在这种情况下,即使浏览器IE"被检查并返回 false,我也会继续使用这个正则表达式并检查它是否与用户代理匹配:

in this case, even if the browser "IE" is checked and returns false, I go ahead and use this regex and check to see if it is a match against the user agent:

(?:(MS)?IEs+|Trident/7.0;.*s+rv:)(d+)

我希望这对某人有所帮助.我测试了它并且工作正常.我还将 rv 更改为 12 及更高版本,如果在 IE12 中将 rv 更改为 12,它也可以正常工作.

I hope this helps someone. I tested it and works fine. I also changed the rv to be 12 and upwards, and it works fine too in case if in IE12, they change rv to be 12.