Blog

Apps - The easiest way to determine the OS and browser details of the end user device

If you need to determine the OS and browser of the device that a user is using, this post describes the easiest way to carry out this task

In the past, it hasn't been easy to detect the OS or the browser of the end user device. In a previous post, I described the workaround to carry out this task by calling a Flow.


The great news is that following a recent update to Power Apps, this task has become very simple.

Introducing the Host object

The update to Power Apps introduces a Host object. This is available in all canvas app designers, including Power Apps for Teams and SharePoint integrated forms. 



Detecting the end user browser and OS using the Host object

We can now access the Host object from within any formula in Power Apps. This exposes the following 3 properties:

  • BrowserUserAgent
  • OSType
  • SessionID



Here's a screenshot that highlights the values of these properties on a Windows 10 PC whilst in edit mode.



Playing the app on a mobile device using the Android Player reveals the following browser user agent. notice how the BrowserUserAgent contains the word 'PowerApps'.

The BrowserUserAgent string provides the most detail about the browser and device that's hosting the app.

A great place to decipher the BrowserUserAgent string is WhatIsMyBrowser.com. This site contains a database of browser agent strings and also includes an API to lookup device and browser details from an input 'browser user agent' string.


https://www.whatismybrowser.com/guides/the-latest-user-agent/windows

Conclusion

The introduction of the host object makes it easier to determine the browser and OS of the end user device. This enhanced detection capability makes it possible to write formula that conditionally enables or disables app features based on the device.