浏览器更新
基于 browser-update 封装的浏览器更新检测方案
Preview

安装
npm install @forchange/browser --save
or
yarn add @forchange/browser --save
使用
import browserUpdate from '@forchange/browser'
browserUpdate(options)
<link rel="stylesheet" type="text/css" href="https://res.pandateacher.com/YU5EVOAS1608262413089.css">
<script src="https://res.pandateacher.com/SFGIRZ1S1608261981445.umd"></script>
<script>window.browserUp({required: {chrome:false}})</script>
options配置项
详细配置
{
required:{
chrome:-1,
firefox:-1,
edge:-1,
uc:-1,
safari:-1,
ie: false,
opera: -1,
yandex: -3,
vivaldi: '1.95',
samsung: '12.1'
},
reminder:20,
reminderClosed:150,
test:false,
lang:'zh-CN',
text:'',
noCloseBtn:false,
url:''
}
text 自定义配置项
text: {
msg:'Your web browser ({brow_name}) is out of date.',
msgmore: 'Update your browser for more security, speed and the best experience on this site.',
bupdate: 'Update browser',
bignore: 'Ignore'
}
css样式
browser-update默认设置了提示的样式,您可以使用自己的css样式来覆盖他们。为来确保正确覆盖您需要额外向您的样式规则添加一些选择器,例如:
body .buorg {
font-size:20px
}
全局样式加上屏蔽test生成报错元素
.buorg .buorg-test {
display: none;
}
测试
- 设置
test: true界面报错不需关心
- 如果您打开的网页的链接末尾带有 #test-bu ,那么通知条会一直生成。例如:
http://browser-update.org/#test-bu 请在新的标签页中打开该网址以保证网页被正确地重新加载。更多详细信息(英文)
通知
封装 browser-update@3.3.25