Search In This Blog

2022-07-02

Get browser type in Lightning Aura/LWC

In Aura

if ($A.get("$Browser.formFactor") != 'DESKTOP') {

    // do something for mobile only here

}


In LWC

import formFactorPropertyName from '@salesforce/client/formFactor'

if (formFactorPropertyName == "Large") {

    // Large—A desktop client.

    // Medium—A tablet client.

    // Small—A phone client.

}


No comments:

Post a Comment