mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
utils service. added browser detection method to utils
This commit is contained in:
22
src/services/utilsService.js
Normal file
22
src/services/utilsService.js
Normal file
@@ -0,0 +1,22 @@
|
||||
function UtilsService() {
|
||||
initUtilsService();
|
||||
};
|
||||
|
||||
function initUtilsService() {
|
||||
UtilsService.prototype.getBrowser = function () {
|
||||
if (navigator.userAgent.indexOf("Firefox") !== -1 || navigator.userAgent.indexOf("Gecko/") !== -1) {
|
||||
return 'firefox';
|
||||
}
|
||||
if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) {
|
||||
return 'opera';
|
||||
}
|
||||
if (navigator.userAgent.indexOf(" Edge/") !== -1) {
|
||||
return 'edge';
|
||||
}
|
||||
if (window.chrome) {
|
||||
return 'chrome';
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user