Wondering if it is at all possible.
found:
<script type="javascript">
isSafari3 = false;
if(window.devicePixelRatio) isSafari3 = true;
</script>
on http://dustinbrewer.com/css-hackgetting-safari-to-behave/. but it seemed to target both chrome and safari, i’m assuming it’s more of a webkit target. also
console.log(isSafari3);
returned with a px count, not a boolean value. so i’m not sure what that guy was talking about.
thanks for the help.
You cannot reliably use the existence of devicePixelRatio to reliably detect just Safari. It might work today, but nothing is stopping some other browser from implementing that and then your code would be completely broken.
It is generally a bad idea to test for a specific browser. The smarter thing to do is to test for a particular feature you want to use. If the browser shows the feature exists, you use it, if not, you use some other fallback mechanism.
Feature detection is much, much easier to maintain because as browsers change, you don’t have to continually change your code to tweak the behavior for different versions of each browser. As browsers evolve by adding support for the latest features, your code automatically adapts to them.
Here’s an article about feature detection: http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting. The library modernizr contains a lot of feature detection code snippets which you can either use in whole or see how it detects features and use just that specific detection.