Mobile Detect
This feature is based on Mobile Detect, a PHP library for mobile device detection.
It works by parsing the User Agent request header on the server side, and guessing the device and browser. There are some reasons why it's not always recommended (see this article on technical limitations). The user agent can be changed by the user, and its syntax is inconsistent for historical reasons. Also, new mobile devices could start using a different keyword, and specific support may need to be added in the library.
In most situations, client-side solutions are better. For responsive design and styling purpose, use CSS media queries to detect the viewport size. For feature detection, use JavaScript.
That said, a suitable use of Mobile Detect might be to show and hide content based on the detected device. This allows sending a simpler website or shorter article, possibly in addition to using responsive images.
Device variable type
Use the variable type device
to detect the device type.
<Get device=type />
Its value is mobile
, tablet
, or desktop
.
Device conditions
Use the If
tag with condition device
to show or hide content based on device type.
<If device=mobile>
Mobile view
<Else if device=tablet />
Table view
<Else />
Desktop view
</If>
<If not device=desktop>
Mobile and tablet view
</If>