JavaScript 代码将 IE 10 检测为受支持的版本而不是过时的版本

JavaScript code detects IE 10 as supported version instead of as out of date

即使版本是 IE 10,下面的代码也会生成警告“您的浏览器受支持”。它与 IE 9、8 和 7 等浏览器完美配合。我需要确保只允许 IE 11 版本。代码真的有问题吗?

<script type="text/javascript">
    jQuery(document).ready(function($){
    // true on IE11
    // false on Edge and other IEs/browsers.        filters.hide();
    // Allow only IE 11 and other browsers like Chrome, Safar, firefox so on,
    // but never allow lower versions of IE starting IE 10.
    var div = document.createElement("div");
    div.innerHTML = "<!--[if lt IE 11]><i></i><![endif]-->";
    var isIeLessThan11 = (div.getElementsByTagName("i").length == 1);
    if (isIeLessThan11) {
      alert("Your web browser is out of date. Please complete this form using an approved browser, such as Edge, Chrome, Safari, or Firefox.");
    } else {
      alert("Your browser is supported");
    }
  });
</script>

根据维基百科,IE10 及更高版本不支持条件注释。 https://en.m.wikipedia.org/wiki/Conditional_comment