Get User Browser Information in Lightning Component

We can use $Browser global value provider to get information about the hardware and operating system of the browser accessing the application.

Use $Browser in Lightning Component:

<aura:component>
    {!$Browser.isTablet}
    {!$Browser.isPhone}
    {!$Browser.isIPad}
    {!$Browser.isIPhone}
    {!$Browser.isWindowsPhone}
    {!$Browser.isIOS}
    {!$Browser.isAndroid}
    {!$Browser.formFactor}
</aura:component>

Use $Browser in Lightning JS Controller:

doInit : function(component, event, helper) {
    var device = $A.get("$Browser.formFactor");
    alert("You are using a " + device);
},