device icon indicating copy to clipboard operation
device copied to clipboard

Fail to detect iPad ios 13+

Open jooohyunpark opened this issue 5 years ago • 8 comments

On latest ios(13+) Safari, it detects iPad as a desktop. Works properly on chrome and other mobil devices. Could you take a look at this issue?

jooohyunpark avatar Oct 04 '19 21:10 jooohyunpark

Hi, @byjoohyunpark

With latest iPad, Desktop Mode is enabled by default. So I think that that is expected result.

dotneet avatar Oct 05 '19 04:10 dotneet

Hey @dotneet, thanks for the reply. Safari in IPad IOS 13+ now forces desktop mode as a default. This issue is solved by disabling it. But I guess eventually we will need some extra layer to deal with this setup.

jooohyunpark avatar Oct 11 '19 23:10 jooohyunpark

I am having the same issue, can you please let me know how did you disable the force desktop mode.

ruchitabavishi avatar Nov 07 '19 12:11 ruchitabavishi

You can create one plugin like below as a temporary solution: This way you can set the device to tablet in case of ipad

export default (context, inject) => { if(context.store.state.userAgent.includes('iPad')) { inject('device', { isTablet: true }); } };

sunilrana123 avatar Nov 08 '19 08:11 sunilrana123

@sunilrana123 your code will overwrite all $device property, so there will be only isTablet: true. You need to pass the remaining properties to save them:

export default function (ctx, inject) {
  const customIsTabet = ctx.isTablet || ctx.store.state.userAgent.includes('iPad')

  inject('device', {
    isTablet: customIsTabet,
    isMobile: ctx.isMobile,
    isMobileOrTablet: ctx.isMobileOrTablet,
    isDesktop: !ctx.isMobileOrTablet,
    isIos: ctx.isIos,
    isWindows: ctx.isWindows,
    isMacOS: ctx.isMacOS,
    isDesktopOrTablet: !ctx.isMobile,
    isAndroid: ctx.isMobileOrTablet && !ctx.isIos
  })
}

Hope this helps.

iliyaZelenko avatar Dec 25 '19 13:12 iliyaZelenko

You can now overwrites any flags or add new ones by creating a Nuxt plugin with the v2 of this module.

See https://github.com/nuxt-community/device-module#add-a-custom-flag

atinux avatar Jan 27 '21 11:01 atinux

iPad even in desktop mode could be detected by a touch events, because no macOS has touch screen.

iBobik avatar Nov 07 '21 23:11 iBobik

iPad useragent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15". How to detect is tablet for iPad?

krkaa avatar Nov 11 '21 10:11 krkaa