浏览器兼容性检测

This commit is contained in:
严俊东 2020-07-06 11:06:01 +08:00 committed by Gitee
parent 31765f6392
commit aa81008bd1

View File

@ -7,6 +7,39 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
<script>
function compatible() {
// flex支持属性
return !!support_css3('flex')
}
var support_css3 = (function () {
var div = document.createElement('div'),
vendors = 'Ms O Moz Webkit'.split(' '),
len = vendors.length;
return function (prop) {
if (prop in div.style) return true;
prop = prop.replace(/^[a-z]/, function (val) {
return val.toUpperCase();
});
while (len--) {
if ((vendors[len] + prop in div.style) || ('-' + vendors[len] + '-' + prop).toLowerCase() in div.style) {
return true;
}
}
return false;
};
})();
if (!compatible()) {
var msg = '当前浏览器版本过低请使用qq浏览器或360浏览器、谷歌浏览器。若已使用qq浏览器或者360浏览器请使用极速模式。'
alert(msg)
window.onload = function () {
document.write(msg)
}
}
</script>
<style>
html,
body,