判断浏览器版本提示升级的代码

    <script>

        // ie10以下浏览器升级提示

        function hiUpgrade() {

            window.AESKey = '';

            // 判断浏览器是否支持placeholder属性

            function isSupportPlaceholder() {

                var input = document.createElement('input');

                return 'placeholder' in input;

            };

            //判断是否是IE浏览器,包括Edge浏览器

            function IEVersion() {

                //取得浏览器的userAgent字符串

                var userAgent = navigator.userAgent;

                //判断是否IE浏览器

                var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;

                if (isIE) {

                    // ie10及以下

                    var reIE = new RegExp("MSIE (\\d+\\.\\d+);");

                    reIE.test(userAgent);

                    var fIEVersion = parseFloat(RegExp["$1"]);

                    if (fIEVersion <= 10 || !isSupportPlaceholder()) {

                        return true;

                    }

                } else if (!!window.ActiveXObject || "ActiveXObject" in window) {

                    // ie11

                    return true;

                } else {

                    return false;

                }

            }

            var tpl = '<div id="hi-upgrade"> <div class="hi-wrap"> <p class="hi-title">无法正常浏览本网站!</p> <div class="hi-text1"> <p>1、您的浏览器版本过低,请升级您的浏览器。</p> <p>2、如果您的浏览器是最新版本,请<span>切换到极速模式</span>访问。</p> <p>3、您使用的是IE浏览器,请<span>使用主流浏览器</span>访问。</p> </div> </div> </div>';

            if (IEVersion()) {

                document.write(tpl);

            }

        }

        hiUpgrade();

    </script>

    <!-- 判断浏览器版本 -->