May I recommend feature detection.
if (someIEAPI) { // ie code } else if (someChromeAPI) { // chrome code }
This code is more reliable, and if firefox or opera supports one of the APIs, you still do not need to check their browsers.
In addition, browsers have a habit of lying to you and pretending to be hips.
source share