低版本ie 提示

<script>
   var DEFAULT_VERSION = "9.0";
   var ua = navigator.userAgent.toLowerCase();
   var isIE = ua.indexOf("msie") > -1;
   var safariVersion;
   if (isIE) {
      safariVersion = ua.match(/msie ([\d.]+)/)[1];   //获取浏览器版本号
   }
   if (safariVersion * 1 <= DEFAULT_VERSION * 1) {   //若版本号低于IE9,则跳转到如下页面
      // alert(11111111111)
      // window.location.href = "https://www.baidu.com/";    //提示页面(修改路径)
      document.write("<div class='ie-box'>" +
         "<img src='/static/img/warning.png' class='warning'>" +
         "<span class='ie-box-text'>当前版本过低,请下载更高版本或其他浏览器</span> " +
         "<br> " +
         " <a class='chrome-text' href='https://www.google.cn/chrome/'><img src='/static/img/chrome.png' class='chrome'></a> " +
         " </div>")
   }
</script>

/*兼容ie*/
.ie-box {
	font-size: 20px;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100;
	width: 100%;
	height: 100%;
	padding-top: 200px;
	background-color: #2c2c2c;
	text-align: center;
	color: #999;
	letter-spacing: 1px;
}
.ie-box .warning {
	margin-right: 10px;
}

.ie-box .chrome {
	margin-top: 50px;
}

猜你喜欢

转载自blog.csdn.net/czy279470138/article/details/87936664