LoginSignup
30
30

More than 5 years have passed since last update.

IE11 に騙されない UserAgent の判別

Last updated at Posted at 2014-04-01

IE11 に騙されない UserAgent の判別

2014.4.1 現在

IE11 は ua.indexOf("msie") > -1 が false を返してしまうのでした...

こうしておけばもう騙されないっ(・ん・)ノ

var isIE = function() {
  var ua = window.navigator.userAgent;
  var ie = ua.match(/MSIE/) || ua.match(/Trident/);
  return ie? true: false;
}

これで全ての IE を判別できるはずです.

var ie = isIE();
if (ie) {/*IE だったときの処理*/}
30
30
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
30