diff --git a/src/lib/dom/browser.ts b/src/lib/dom/browser.ts index 256557ca5..892cb0c0b 100644 --- a/src/lib/dom/browser.ts +++ b/src/lib/dom/browser.ts @@ -6,8 +6,18 @@ export const isSafari = () => { return ua.includes('safari') && !ua.includes('chrome') && !ua.includes('edge') } +/** 特定の条件のiPadだとuaに'ipad'の文字列を含まない + * https://qiita.com/ShingoFukuyama/items/ef573a8e3e23ef12542e + * 'macinstosh'だとmacOSも含まれてしまうため、含まないように`'ontouchend' in document`の条件も追加 + * https://jsnotice.com/posts/2019-09-08/index.html + */ export const isIOS = () => { - return ua.includes('iphone') || ua.includes('ipod') || ua.includes('ipad') + return ( + ua.includes('iphone') || + ua.includes('ipod') || + ua.includes('ipad') || + (ua.includes('macintosh') && 'ontouchend' in document) + ) } export const isFirefox = () => {