Wednesday, 4 April 2018

Detect IE11

I'm old enough to remember why we needed jQuery: IE6.

Now I'm less used to using it and prefer vanilla JS but still wish for its universal levelling of the playing field because now I have to deal with the peculiarities of IE11 on a near daily basis so, thanks to this answer on StackOverflow, you'll often see this peppering my code:

if(!!navigator.userAgent.match(/Trident.*rv\:11\./)){
    // Do something peculiar...
}