📜 ⬆️ ⬇️

Mobile version of the site or responsive design?

With the beginning of the boom era of mobile devices, developers were faced with a choice: should they keep mobile versions of their sites along with “full-fledged” ones, or should sites become adaptive and independently adjust to different screen sizes?

Currently, when building mobile versions of sites, there are 3 main ways to build them:


Each of the methods has its own advantages and disadvantages, which I will try to describe in detail.

Adaptive design


CSS3 Media Queries are commonly used to implement responsive design. Depending on the screen size, the user will see a different picture:
')
@media screen and (max-width: 1600px) { div.for-example {width: 1500px;} } @media screen and (max-width: 1280px) { div.for-example {width: 1100px;} } @media screen and (max-width: 1024px) { div.for-example {width: 980px;} } 

Advantages of responsive design


Disadvantages of responsive design


In general, the idea of ​​developing a mobile version in an adaptive design is quite popular, despite the above-mentioned disadvantages. In particular, this concept is fully supported by such giants as, for example, Google.

Separate mobile site version


In order to make a website convenient for mobile users, often also create separate versions of sites - specifically targeted at users with a smartphone / tablet. The most common practice is to redirect mobile users to a special subdomain (m.example.com, mobile.example.com, etc.). Probably, in 99% of cases, the mobile version is a reduced basic version - only with the functionality that, according to developers, will be necessary and useful to users of mobile devices and tablets.
The advantages of the mobile version


Disadvantages of the mobile version



In general, the creation of mobile versions of sites justifies itself quite well, in particular, for large projects. As an example, Amazon uses a special, mobile version of the site.

RESS


Google itself, although it supports the use of responsive design by webmasters, however, uses a different system in its products. If you go, for example, to the main page under different User-Agents, you can see different HTML for different devices. RESS - Responsive Design + Server Side. Implementation example, sketched "on the knee":

 $DS = DIRECTORY_SEPARATOR; require_once( dirname(__FILE__) . $DS . 'libraries' . $DS . 'browser.php'); $device = BBrowser::detectDevice(); if($device == DEVICE_TYPE_MPHONE){ $tmpl = 'template.m.php'; } else if($device == DEVICE_TYPE_TABLET){ $tmpl = 'template.t.php';} else{ $tmpl = 'template.php'; } include( dirname(__FILE__) . $DS . 'templates' . $DS . $tmpl); 

RESS pluses

In fact, the method may include the advantages of both a separate mobile and adaptive version of sites, depending on the implementation. From what will be new:

Cons RESS



In general, the RESS is the best of the three options proposed, but it requires much more labor.

Summary


In my personal opinion, there is no ideal option that everyone should use. The best option for me is RESS. However, this is one of the rare options, since it requires a lot of effort to implement. In general, all 3 options have their pros and cons, and depending on the essence and focus of the site.

Source: https://habr.com/ru/post/239441/


All Articles