Skip to content

Instantly share code, notes, and snippets.

@chrismcintosh
Created January 21, 2020 21:13
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 chrismcintosh/996671181b608a757484a528e42f4209 to your computer and use it in GitHub Desktop.
Save chrismcintosh/996671181b608a757484a528e42f4209 to your computer and use it in GitHub Desktop.
import Bowser from "bowser"
const bowser = Bowser.parse(window.navigator.userAgent)
document.addEventListener("DOMContentLoaded", function(){
document.body.classList.add(`browser-${bowser.browser.name.toLowerCase()}`)
document.body.classList.add(`os-${bowser.os.name.toLowerCase()}`)
document.body.classList.add(`platform-${bowser.platform.type.toLowerCase()}`)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment