R
R
Roman Tatarinov2016-09-07 10:51:12
HTML
Roman Tatarinov, 2016-09-07 10:51:12

How to understand from which device a person came in to enable the mobile version for him?

Previously, I always tied to the screen resolution, and through media queries. Actually, now too. Only here a question arose. Let's say the iPad has a resolution of 2560 pixels. But he needs to download the mobile version. So the question is how to properly organize it. I understand that you simply distribute the body class and prescribe the necessary styles. The question is how to determine from which device you entered, and at what point in the version to determine? What tools and with what? modernizer, please do not offer) There must be something minimalistic, quickly customizable, productive and not difficult to develop)

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
Rafael™, 2016-09-07
@maxminimus

my approach is as simple as possible:
two or three versions of media queries - for smartphones, for tablets, for monitors
plus vertical and horizontal options
- that is, from four to six styles the 02ad2613a6b541558cc30f0830be7013.jpg
difference is only in screen sizes and interface elements
and each application must be mobile first - that is, first touch interface

Z
zooks, 2016-09-07
@zooks

For mobile devices, you need to consider the size of the viewport, not the resolution.

K
Kirill Kublyakov, 2016-09-07
@Kublyakov

Define useragent using javascript - Google is full of ready-made implementations.
If you are completely lazy, then here is matthewhudson.me/projects/device.js
And for the iPad in media, not 2560, the value needs to be set, but much less =)

S
Sergey Melnikov, 2016-09-07
@mlnkv

stackoverflow.com/questions/4817029/whats-the-best...

function isTouchDevice() {
  return 'ontouchstart' in window // works on most browsers 
      || navigator.maxTouchPoints;  // works on IE10/11 and Surface
}

A
Ankhena, 2016-09-07
@Ankhena

See viewport sizes: viewportsizes.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question