XF 2.2 XF Conditional for basic mobile/desktop detection?

Does XF 2.2.x offer a conditional that can detect mobile/desktop browser?

Thanks.
That doesn't work out of the box with XF, but XON has an add-on for it.
 
  • Like
Reactions: rdn
For what it's worth, there is some support in XF 2.2+ for determining the OS/browser of a visitor via the request object:

PHP:
\XF::app()->request()->getBrowser()

HTML:
$xf.request.getBrowser()

Though it's probably not as comprehensive as the add-on linked above.
 
It returns an array of OS and browser names and versions (it's pretty much identical to the XF.browser JS object). You can dump it to get a better idea:

HTML:
dump($xf.request.getBrowser())

So, for example...
HTML:
<xf:if is="$xf.request.getBrowser().os == 'ios' || $xf.request.getBrowser().os == 'android'">
    <!-- visitor is using iOS or Android -->
</xf:if>
 

Similar threads

Top Bottom