Browser makers, including Apple, always say to use feature detection - i.e. to use features when they appear to be available. The alternative is user-agent sniffing, which they advise against.
In most cases I have found that feature detection + a blacklist of problematic browsers is often a good compromise. But there is no perfect solution.