Created
October 31, 2018 21:14
-
-
Save akrizs/c21885dddfaf58242ebfead4984f21c9 to your computer and use it in GitHub Desktop.
BrowserCheck => Hope to revisit this later...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helpers.bc = { | |
bx: document.createElement('div'), | |
st: document.createElement('div').style, | |
is() { | |
if (this.safari()) { | |
return 'Safari'; | |
} | |
if (this.chrome()) { | |
return 'Chrome'; | |
} | |
if (this.firefox()) { | |
return 'Firefox'; | |
} | |
if (this.opera()) { | |
return 'Opera'; | |
} | |
if (this.vivaldi()) { | |
return 'Vivaldi'; | |
} | |
}, | |
safari() { | |
if (!(window.safari == undefined) && window.navigator.userAgent.includes('Safari') && window.navigator.vendor.includes('Apple')) { | |
return true | |
} else { | |
return false | |
} | |
}, | |
chrome() { | |
if (!(window.chrome.webstore === 'undefined') && | |
window.navigator.userAgent.includes('Chrome') && | |
!(window.navigator.userAgent.includes('Vivaldi')) && | |
!(window.navigator.userAgent.includes('Opera')) && | |
window.navigator.vendor.includes('Google') && | |
(window.opr === undefined)) { | |
return true | |
} else { | |
return false | |
} | |
}, | |
firefox() { | |
if (window.navigator.userAgent.includes('Firefox') && | |
!(window.netscape === 'undefined') && | |
!(window.mozPaintCount === 'undefined') && 'MozAppearance' in this.st) { | |
return true | |
} else { | |
return false | |
} | |
}, | |
brave() { | |
}, | |
opera() { | |
if (window.navigator.userAgent.includes('OPR') && | |
!!window.opr.addons) { | |
return true | |
} else { | |
return false | |
} | |
}, | |
vivaldi() { | |
if (window.navigator.userAgent.includes('Vivaldi')) { | |
return true | |
} else { | |
return false | |
} | |
}, | |
msedge() { | |
if (window.style) { | |
} | |
}, | |
layoutEngine: { | |
st: document.createElement('div').style, | |
is() { | |
}, | |
webkit() { | |
if ('WebkitAppearance' in this.st && window.navigator.userAgent.includes('webkit')) { | |
return true | |
} else { | |
return false | |
} | |
}, | |
gecko() { | |
if ('MozAppearance' in this.st && window.navigator.userAgent.includes('Gecko')) { | |
return true | |
} else { | |
return false; | |
} | |
}, | |
khtml() { | |
if ('KhtmlUserInput' in this.st) { | |
return true | |
} else { | |
return false | |
} | |
}, | |
edgeHtml() { | |
if ('msTextSizeAdjust' in this.st && !('msFlex' in this.st) && window.navigator.userAgent.includes('edge')) { | |
return true | |
} else { | |
return false | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment