bowser-js / bowser

a browser detector
Other
5.51k stars 487 forks source link

ipad still wrong #510

Open pm100 opened 2 years ago

pm100 commented 2 years ago

I know this was raised and closed before but I wanted to poke at it again

in this long thread this issue is explored https://developer.apple.com/forums/thread/119186

It is caused by the default setting of 'request desktop site' in ipad on safari, it makes its useragent claim that its an intel mac. This is the default setting

The final entry in that conversation has a fix that works

function iOS() {
  return [
    'iPad Simulator',
    'iPhone Simulator',
    'iPod Simulator',
    'iPad',
    'iPhone',
    'iPod'
  ].includes(navigator.platform)
  // iPad on iOS 13 detection
  || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}

this could be tweaked into working in bowser