JavaScript で IE かどうかを判別する IE 判別関数 (isIe) navigator.userAgent プロパティを参照して、ブラウザのユーザーエージェントを調べることで、使用しているブラウザが IE (Internet Explorer) であるかを判別することができます。 IE の場合、ユーザーエージェント名は MSIE あるいは Trident/ で始まります。 // 使用中のブラウザが IE であるかどうかを判別します。 function isIe() { var ua = navigator.userAgent; return ua.indexOf('MSIE ') > -1 || ua.indexOf('Trident/') > -1; } ただし、navigator.userAgent プロパティの値はブラウザの設定により書き換えられる可能性があることに注意
![使用している Web ブラウザが IE (Internet Explorer) かどうか判別する | まくまくJavaScriptノート](https://cdn-ak-scissors.b.st-hatena.com/image/square/2b98e04afeb75a691cb87ef1ac4afd3d2f417d87/height=288;version=1;width=512/https%3A%2F%2Fmaku77.github.io%2Fassets%2Fimg%2Flogo-js.png)