280
Views
8
Comments
Device Detection
Question
Application Type
Reactive

Hi Team,

I would like to know device detection like when user logs in i would like to show the information like he logged in particular browser how to get those details.

Thanks,

Akash.

2024-07-05 14-16-55
Daniël Kuhlmann
Ā 
MVP

Hi Akash,

Just to be clear you want this for reactive web app users that run your app in a computer browser? 

See this older post:
https://www.outsystems.com/forums/discussion/64249/how-to-make-reactive-web-outsystemsui-device-detection-work/

But even better there is a Forge component for Reactive apps to do this:
https://www.outsystems.com/forge/component-overview/8580/whats-my-browser

For Mobile there are plugins like this one:

https://www.outsystems.com/forge/component-overview/5389/get-device-information

Regards,

Daniel

2022-11-17 07-00-53
Akash Gunupudi

Thanks for the reply and i want to know logged in user location details as well could you please help me out on that 

2024-09-12 02-43-38
Deepsagar Dubey

Hi @Akash Gunupudi 

If you want to show or save browser  name of user then you can use this JavaScript (I know its not recommend to use JS but we can use it as per requirement) code as well.

var browserName = (function(agent) {

    switch (true) {

        case agent.indexOf("edge") > -1:

            return "MS Edge";

        case agent.indexOf("edg/") > -1:

            return "Edge ( chromium based)";

        case agent.indexOf("opr") > -1 && !!window.opr:

            return "Opera";

        case agent.indexOf("chrome") > -1 && !!window.chrome:

            return "Chrome";

        case agent.indexOf("trident") > -1:

            return "MS IE";

        case agent.indexOf("firefox") > -1:

            return "Mozilla Firefox";

        case agent.indexOf("safari") > -1:

            return "Safari";

        default:

            return "other";

    }

})(window.navigator.userAgent.toLowerCase());

 

browserName hold the name of browser,

I hope it'll help you.

Thanks

Deep

2022-11-17 07-00-53
Akash Gunupudi

Thanks for the reply and i want to know logged in user location details as well could you please help me out on that 

2024-09-12 02-43-38
Deepsagar Dubey

Hi,

If you want to do if by javascript then you can use this script -

<script>

var x = document.getElementById("demo");

function getLocation() {

  if (navigator.geolocation) {

    navigator.geolocation.getCurrentPosition(showPosition);

  } else {

    x.innerHTML = "Geolocation is not supported by this browser.";

  }

}


function showPosition(position) {

  x.innerHTML = "Latitude: " + position.coords.latitude +

  "<br>Longitude: " + position.coords.longitude;

}

</script>

Thanks 

2022-11-17 07-00-53
Akash Gunupudi

i have tried this can please share sample oml file it will be helpful for me

2024-09-12 02-43-38
Deepsagar Dubey

Hi Akash,

It's straight forward if you are not allowed to access Location then it'll not work.

Thanks

Deep 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.