I am trying to add a width to a div if browser is safari. I am trying the below algorithm to check through javascript. If there any css or less only code to check if browser is safari and add with to div only on safari? or this is only possible with javascript or js libraries?
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent .indexOf('safari')!=-1){
if(userAgent .indexOf('chrome') > -1){
//browser is chrome
}else if((userAgent .indexOf('opera') > -1)||(userAgent .indexOf('opr') > -1)){
//browser is opera
}else{
//browser is safari, add css
}
}