Created
September 28, 2013 15:23
-
-
Save fmtarif/6743098 to your computer and use it in GitHub Desktop.
browser class through JS
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
//add browser classes to body | |
var browser = []; | |
if (/mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit /.test(navigator.userAgent.toLowerCase())) | |
browser.push('mozila'); | |
if (/webkit/.test(navigator.userAgent.toLowerCase())) | |
browser.push('webkit'); | |
if (/opera/.test(navigator.userAgent.toLowerCase())) | |
browser.push('opera'); | |
if (/safari/.test(navigator.userAgent.toLowerCase())) | |
browser.push('safari'); | |
console.log(browser.join(' ')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment