• A valid XenForo Licence validation token will be required to complete signup and purchasing.
    This may retrieve this from the XenForo Customer Area.
  • All XenForo 2.3+ add-ons require at least php 8.0, recommend php 8.2+
    All XenForo 2.2+ add-ons require at least php 7.2, recommend php 8.x
    All XenForo 2.0-2.1 add-ons require at least php 5.6, recommend php 7.x.
    The Standard Library add-on is also required.
    Older php versions are not supported, and add-ons will either refuse to install or fail to function.
  • Automatic discounts are applied for orders above $100 USD (10%) or for early renewals (5%)

Browser Detection

A light-weight shim around Mobile_detect for XenForo

Overview Copyright info Releases (1)

A light-weight shim around Mobile_detect for XenForo 2

Usage (in templates)

The add-on injects the global variable $xf.mobileDetect, check that the variable is set before calling any methods to prevent errors during upgrades or if the add-on is disabled.

HTML:
<xf:if is="$xf.mobileDetect && $xf.mobileDetect.isMobile()">
    Is Mobile
<xf:else />
    Not Mobile
</xf:if>

HTML:
<xf:if is="$xf.mobileDetect && $xf.mobileDetect.is('Firefox')">
    Is Firefox
<xf:else />
    Not Firefox
</xf:if>

HTML:
<xf:if is="$xf.mobileDetect && $xf.mobileDetect.is('Chrome')">
    Is Chrome
<xf:else />
    Not Chrome
</xf:if>

Usage (in php)

PHP:
$mobileDetect = \SV\BrowserDetection\Listener::getMobileDetection();
$isMobile = $mobileDetect && $mobileDetect->isMobile() ? "_m1" : "_m0";

XF2.1 Page caching

The integration mobile detection with XF2.1+ full-page caching, add to the config.php this;
PHP:
$config['pageCache']['onSetup'] = function (\XF\PageCache $pageCache) {
    $pageCache->setCacheIdGenerator(function(\XF\Http\Request $request) {
        return \SV\BrowserDetection\CacheHelper::getPageCacheId($request);
    });
};

Licence

See MobileDetectLicense.md for Mobile-Detect's licence (MIT licensed)

Product Information

XenForo 2.2+ php 7.2+
Seller
Atelier Aphelion
Release date
Last update
Customer rating
0.00 star(s) 0 ratings

Pricing information

Lifetime
Free

Share this product

Back
Top