Skip to content

Instantly share code, notes, and snippets.

@jbmyid
Forked from realdeprez/browser-class.js
Created March 7, 2017 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbmyid/b03519cb6a791008df398a25620550db to your computer and use it in GitHub Desktop.
Save jbmyid/b03519cb6a791008df398a25620550db to your computer and use it in GitHub Desktop.
adds browser name+version class to html body tag
try{document.getElementsByTagName('body')[0].className+=' '+(/(Firefox|MSIE|Chrome|Safari|Opera)[\/\s](\d+)/).exec(navigator.userAgent).splice(1,2).join('').toLowerCase();}catch(e){}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment