Skip to content

Instantly share code, notes, and snippets.

@mikaelhadler
Last active March 29, 2019 14:55
Show Gist options
  • Save mikaelhadler/9483713dc9e24a8c7c8d814ef483fd75 to your computer and use it in GitHub Desktop.
Save mikaelhadler/9483713dc9e24a8c7c8d814ef483fd75 to your computer and use it in GitHub Desktop.
Service for get name the browser in device
let _getUserDevice = function () {
let userAgent = $window.navigator.userAgent;
let browsers = {chrome: /chrome/i, safari: /safari/i, firefox: /firefox/i};
for(let key in browsers){
if (browsers[key].test(userAgent)) {
return key;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment