Skip to content

Instantly share code, notes, and snippets.

@girvan
Created October 25, 2019 08:09
Show Gist options
  • Save girvan/2ba0ae6f19e7cca8fe96a53258b0d9a6 to your computer and use it in GitHub Desktop.
Save girvan/2ba0ae6f19e7cca8fe96a53258b0d9a6 to your computer and use it in GitHub Desktop.
detect browser and append classname on html element
(function(ua){
var m = ua.match(/(msie|firefox|edge)/);
if(m) document.documentElement.className += m[1];
})(navigator.userAgent.toLowerCase())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment