Skip to content

Instantly share code, notes, and snippets.

@ara303
Last active October 26, 2015 18:50
Show Gist options
  • Save ara303/5f7f410dde965350c4dc to your computer and use it in GitHub Desktop.
Save ara303/5f7f410dde965350c4dc to your computer and use it in GitHub Desktop.
Detect Safari and add a class to the <html> element
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
document.documentElement.classList.add('is-safari');
}
/**
* Credits:
* http://stackoverflow.com/questions/5899783/detect-safari-using-jquery
* https://developer.mozilla.org/en/docs/Web/API/Element/classList
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment