What\'s the least error-prone way to target just IE11 with JavaScript?
Note: This should really only be done for analytics or informing the user what browser they\'r
IE11 keeps "Trident" in it's UA string, but drops MSIE. A simple way to detect the browser is IE11 or above (IE12, IE13, etc) is:
var isAtLeastIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));
If you want just IE11 (and you don't want future versions of IE to match), do this:
var isIE11 = !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/));