Last active
October 26, 2015 18:50
-
-
Save ara303/5f7f410dde965350c4dc to your computer and use it in GitHub Desktop.
Detect Safari and add a class to the <html> element
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
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