浏览器兼容性检测
This commit is contained in:
parent
31765f6392
commit
aa81008bd1
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user