Checking browser compatibility instead of just failing

We use Ionic to build apps that are available as ios and android apps, and also as web applications. However, we occasionally get users with unsupported browsers whining about stuff not working.

Is there a nice clean way to detect browser compatibility so we can pop up a simple alert to let them know to switch to a modern browser rather than just have the app puke all over itself?

UPDATE: got basic functionality working with Bowser check and redirect if bad browser detected, but something built in would be niceā€¦

Thanks!
Klaus

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent