How do I detect if it's iphone or ipad ?

0 favourites
  • 5 posts
From the Asset Store
It's here!
$4.95 USD
Creepy and nasty horror track. It's terrifying from the beginning till the end. Goosebumps guaranteed
  • Hi,

    is there a way to detect if the device is an iphone or ipad please ?

    thanks for help

  • Some conditions that could help:

    (Compare two values)

    Browser.ExecJS("navigator.platform.toLowerCase().indexOf('iphone') > -1") Not Equal To 0

    Browser.ExecJS("navigator.platform.toLowerCase().indexOf('ipod') > -1") Not Equal To 0

    Browser.ExecJS("navigator.platform.toLowerCase().indexOf('ipad') > -1") Not Equal To 0

    Browser.ExecJS("navigator.platform.toLowerCase().indexOf('mac') > -1") Not Equal To 0

    Browser.ExecJS("navigator.vendor.toLowerCase().indexOf('apple') > -1") Not Equal To 0

    I used all the conditions together in OR condition to determine if I'm in iOS device, woked for me like a charm.

    But for your need it should also work independently to determine exact device.

  • Yura G

    thanks a lot

    so if i want to do something on ipad specially ... i have to use the condition "Browser.ExecJS("navigator.platform.toLowerCase().indexOf('ipad') > -1") Not Equal To 0" right ?

  • matrixreal

    Right,

    but that navigator trick sometimes may give false positives and false negatives.

    It never accured to me, and no one complained, but I heard that it can happen, depending on device and browser.

    Just saying, in my opinion it is 99% safe to use.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Could this type of action be used to determinate not only what device is being used but also the screen resolution? (16:9, 16:10, 4:3 and so on?)

    I think this could be really usefull to maybe find a way to adapt the view of your game to the user´s screen resolution and achieve a perfect display in almost all devices.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)