<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script src="js/jquery-3.2.1.min.js"></script>
<body>
<!-- 低版本浏览器警告 -->
<div id="lowBrowser">
<div></div>
<p><span>您的浏览器版本过低,不支持浏览本Wiki,请升级或更换您的浏览器再试!</span></p>
<script>
(function(win) {
var notice = document.getElementById('lowBrowser');
//jQuery 3.x 需要 addEventListener 方法支持
if (typeof win.addEventListener == 'undefined') {
notice.style.display = 'block';
} else {
var comments = notice.previousSibling;
if (comments.nodeType == 8) {
comments.parentNode.removeChild(comments);
} else if (comments.previousSibling.nodeType == 8) {
comments = comments.previousSibling;
comments.parentNode.removeChild(comments);
}
notice.parentNode.removeChild(notice);
}
notice = comments = null;
})(window);
</script>
</div>
</body>
</body>
</html>
浏览器版本太低检测写法