If you're doing user-agent detection, your code is broken by design. Use feature detection instead.
Please. I'm tired of having to use an extension to spoof user-agent in order for some websites to work. The creators of the Vivaldi browser were even forced to permanently spoof Chrome's user-agent due to websites unrecognizing the Vivaldi one.