How detect Safari browser ONLY on desktop?

Viewed 5056

How detect Safari browser ONLY on desktop ?
I want to know only when user is on desktop and not with mobile device.

var ua = navigator.userAgent.toLowerCase(); 
if (ua.indexOf('safari') != -1) { 
    //find safari
}

I noticed that Desktop Safari doesn't support input[type=date] but mobile safari (the name is webkit ?) yes. So for me is important understand when user is on desktop.

Thanks a lot and sorry for my english.

1 Answers
const uA = navigator.userAgent;
const vendor = navigator.vendor;
if (/Safari/i.test(uA) && /Apple Computer/.test(vendor) && !/Mobi|Android/i.test(uA)) {
  //Desktop Safari
}
Related