NetTalk Central

Author Topic: Identfy device mobile phone / tablet or desktop  (Read 3109 times)

Andjane

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Identfy device mobile phone / tablet or desktop
« on: August 21, 2013, 11:09:38 PM »
I have been able to determine if the user is accessing my web server via a device or desktop. So if a user logs in via a device it goes to my mobile web site.
But this also happens with a tablet. Is there a way to identify that it is a tablet and then be able to show it in the normal desktop mode ?

Thanks In Advance

Regards

Andreas

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Identfy device mobile phone / tablet or desktop
« Reply #1 on: August 22, 2013, 09:46:29 PM »
Hi Andreas,

There are a couple of things you can do.

Firstly the fundamental thing you want to know is the "size of the screen". Preferably the physical size - like in inches. Unfortunately there's no way to determine that.

Second best thing to know is the screen resolution. You'll get this from the device, but only _after_ the first page has been sent to the device. If your starting page is the same each time, and you craft it carefully to work both ways, then from there on it can make the distinction based on the screen size (in pixels). Of course a small retina screen may have more pixels than a large "regular" screen. So it's a clue, but until everything is retina, your mileage may vary.

The p_web._useragent property does contain some information from the browser, but it changes with each new device. So while you can, for example, detect "ipad" in the string (and thus know it's an iPad) there's no consistent Agent string for Android tablets (as distinct from Android phones.) And of course the line between phone and table, on android is blurry.

The best option seems to be to give the use a menu item where they can choose to be in desktop mode, or mobile mode.

cheers
Bruce

Andjane

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • Email
Re: Identfy device mobile phone / tablet or desktop
« Reply #2 on: August 23, 2013, 08:34:53 AM »
 Thanks Bruce

Much appreciated.

Food for thought.

Regards

Andreas