As an author you have two main options:
1. Feature detection: check to see if the API exists in the browser, and gracefully fall back if not.
2. UA-sniffing: use the API only on browsers where you've verified that your program works correctly with its implementation.
There's pretty strong consensus on the web that authors should be doing (1), and that (2) is harmful to minority browsers. Every time someone says "the new feature works fine in Firefox if I set my UA to Chrome" they're complaining that the site didn't go with (1).
Yes, using (1) means trusting browsers to get their implementations correct, but they are usually very good about this and getting better. The http://wpt.fyi tests have been a big help here.