IE user agent regexp (including IE11 and compat view)

夙愿已清 提交于 2019-12-06 13:25:31

Using regex pattern

(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)

you match all current known IE browser user agent strings and the number matching in group #1 determinate version of IE (if not running in Compatibility View).


To find out if IE is running in Compatibility View, lookup for match of

\bMSIE\s+7\.0;.*\bTrident\/(\d+)\.0

The number matching in group #1 (after keyword "Trident") determinate version of IE in Compatibility View as follow:

4 -> IE  8 in CV
5 -> IE  9 in CV
6 -> IE 10 in CV
7 -> IE 11 in CV
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!