Skip to content

Instantly share code, notes, and snippets.

@AienTech
Created October 19, 2017 19:43
Show Gist options
  • Save AienTech/852049644955faa848b5d55a2da34d87 to your computer and use it in GitHub Desktop.
Save AienTech/852049644955faa848b5d55a2da34d87 to your computer and use it in GitHub Desktop.
Check for browser name
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
var isFirefox = typeof InstallTrigger !== 'undefined';
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
var isIE = /*@cc_on!@*/false || !!document.documentMode;
var isEdge = !isIE && !!window.StyleMedia;
var isChrome = !!window.chrome && !!window.chrome.webstore;
var isBlink = (isChrome || isOpera) && !!window.CSS;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment