Created
June 9, 2013 17:23
-
-
Save TimPietrusky/5744384 to your computer and use it in GitHub Desktop.
A CodePen by Tim Pietrusky. Detect Safari 6+ - With 2/3 dirt and 1/3 feature detection.
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
/** | |
Detect Safari 6+ | |
With 2/3 dirt and 1/3 feature detection. | |
CSS filter are implemented in Safari 6+ | |
http://caniuse.com/css-filters | |
Warning: userAgent stuff is bad. | |
But it should work in most of the cases. | |
Use at your own risk >:D | |
# 2013 by Tim Pietrusky | |
# timpietrusky.com | |
**/ | |
var isSafari6 = | |
!!navigator.userAgent.match(/safari/i) && | |
!navigator.userAgent.match(/chrome/i) && | |
typeof document.body.style.webkitFilter !== "undefined"; | |
document.body.innerHTML = isSafari6 ? 'this is Safari 6+' : 'this is NOT Safari 6+'; | |
document.body.className = isSafari6 ? 'isSafari6' : 'not'; |
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
@import "compass"; | |
@import url(http://fonts.googleapis.com/css?family=Trocchi); | |
body { | |
margin:1em 0; | |
font: 700 3.5em 'Trocchi' sans-serif; | |
letter-spacing:.075em; | |
color: #fff; | |
text-align:center; | |
&.isSafari6 { | |
background:#3d9d34; | |
} | |
&.not { | |
background:#bf4440; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment