Salesforce provides global function called $Browser. By
using this, you can dynamically identify or detect a device and display
contents based on device.
The $Browser global value provider returns information about
the hardware and operating system of the browser accessing the application.
- <aura:component >
- <aura:if isTrue="{!$Browser.isTablet}">
- You are running this page from your tablet.
- </aura:if>
- <aura:if isTrue="{!$Browser.isAndroid}">
- You are running this page from your andriod device.
- </aura:if>
- <aura:if isTrue="{!$Browser.formFactor=='DESKTOP'}">
- You are running this page from your desktop.
- </aura:if>
- </aura:component>
Reference: