I would like to know what is the best way to detect if the browser is safari and also its version? I want to show something else if the browser is safari and its version is < 13. I was looking at different answers, but did not find a best answer. What I have so far is as below. But it seems it is not applicable to mobile and other things.
const ua = userAgent.toLocaleLowerCase();
if (!userAgent) {
return false;
}
if (ua.indexOf('safari') !== -1) {
return !(ua.indexOf('chrome') > -1 || ua.indexOf('edg'));
}