【文件属性】:
文件名称:浏览器检测:使用用户代理检测浏览器,返回浏览器的名称和版本
文件大小:98KB
文件格式:ZIP
更新时间:2021-02-19 14:23:34
JavaScript
检测浏览器
使用用户代理进行浏览器检测。 StatCounter于2017年10月在全球最受欢迎的浏览器上进行了测试。
值得重申:使用用户代理嗅探很少是一个好主意。 您几乎总能找到一种更好,更广泛兼容的方法来解决您的问题!
更多细节
安装
npm i browser-version-detection --save
脚本返回带有浏览器名称和版本的对象,例如:
const output = {
name : 'Chrome' ,
version : 62 ,
}
API
获取浏览器名称和版本
import { detectBrowser } from 'browser-version-detection' ;
detectBrowser ( window . navigator ) ;
输出
const output = {
name : 'Chrome' ,
ve
【文件预览】:
browser-detection-master
----.gitattributes(14B)
----.eslintrc.js(116B)
----webpack.config.js(450B)
----src()
--------rendering-engine-detection.test.js(2KB)
--------is-deprecated.test.js(940B)
--------is-deprecated.js(668B)
--------browser-detection.js(5KB)
--------browser-detection.test.js(5KB)
--------rendering-engine-detection.js(660B)
----babel.config.js(204B)
----.npmignore(207B)
----.idea()
--------misc.xml(174B)
--------codeStyleSettings.xml(277B)
--------watcherTasks.xml(139B)
--------jsLibraryMappings.xml(187B)
--------check-browser.iml(458B)
--------inspectionProfiles()
--------modules.xml(278B)
--------codeStyles()
--------vcs.xml(180B)
----.travis.yml(561B)
----LICENSE(1KB)
----README.md(2KB)
----CODE_OF_CONDUCT.md(3KB)
----.gitignore(425B)
----CHANGELOG.md(143B)
----package-lock.json(387KB)
----package.json(1KB)