{"id":37418,"date":"2024-02-20T15:05:16","date_gmt":"2024-02-20T09:35:16","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=37418"},"modified":"2024-02-20T17:25:37","modified_gmt":"2024-02-20T11:55:37","slug":"how-to-know-browser-and-os-details-in-power-apps-using-host-object","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2024\/02\/how-to-know-browser-and-os-details-in-power-apps-using-host-object\/","title":{"rendered":"How to Know Browser and OS Details in Power Apps using Host Object"},"content":{"rendered":"<p>Recently, I was working on a project where we created a Login form in the <a href=\"https:\/\/www.inogic.com\/services\/microsoft-power-platform\/microsoft-power-apps-canvas-app\/\" target=\"_blank\" rel=\"noopener\">Canvas App<\/a> compatible with iPhone systems only. Throughout the development phase, we faced challenges in determining the client&#8217;s specifics like browser type or device, especially since our app needed to function across specific browsers and on iPhones. Upon conducting online research, we discovered the Host Object within Power Apps. This object proved instrumental as it offered vital information including the client&#8217;s OS type, user agent, session ID, and tenant ID.<\/p>\n<p>In this blog post, we delve into the intricacies of the Power Apps Host object, exploring its capabilities in retrieving user host details and enhancing application functionality.<\/p>\n<h2><strong>Understanding the Power Apps Host Object:<\/strong><\/h2>\n<p>The Host object in Power Apps serves as a valuable resource for us seeking to obtain vital information about the client&#8217;s environment. It encapsulates various properties that offer insights into the user&#8217;s system, including:<\/p>\n<p><strong>Client&#8217;s Operating System Type<\/strong><\/p>\n<p>By accessing the Host object, we can retrieve information about the operating system (OS) running on the user&#8217;s device. This feature enables applications to adapt the functionality based on the specific OS, ensuring compatibility and optimal performance.<\/p>\n<p>Example:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-37426\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/1Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"770\" height=\"210\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/1Power-Apps-using-Host-Object.jpeg 598w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/1Power-Apps-using-Host-Object-300x82.jpeg 300w\" sizes=\"(max-width: 770px) 100vw, 770px\" \/><\/p>\n<p><strong>Note<\/strong>: <strong>Don&#8217;t change the experience or functionality of your app based on the reported operating system by using the OSType<\/strong><\/p>\n<p><strong>BrowserUserAgent <\/strong><strong>User Agent Details<\/strong><\/p>\n<p>The Host object provides access to the user agent string, which contains valuable information about the client&#8217;s browser, device, and platform. This data is instrumental in tailoring the app&#8217;s interface and behavior to effectively suit the user&#8217;s environment.<\/p>\n<p>Example :<\/p>\n<p><strong> <img decoding=\"async\" class=\"alignnone wp-image-37425\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/2Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"744\" height=\"157\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/2Power-Apps-using-Host-Object.jpeg 687w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/2Power-Apps-using-Host-Object-300x63.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/2Power-Apps-using-Host-Object-660x139.jpeg 660w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><\/strong><\/p>\n<p><strong>Session ID<\/strong><\/p>\n<p>Session is crucial for maintaining the continuity of user interactions within the application. With the Host object, we can access and manage session IDs, facilitating seamless navigation and user experience throughout the app&#8217;s lifecycle.<\/p>\n<p>Example :<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-37424\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/3Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"921\" height=\"120\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/3Power-Apps-using-Host-Object.jpeg 921w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/3Power-Apps-using-Host-Object-300x39.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/3Power-Apps-using-Host-Object-768x100.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/3Power-Apps-using-Host-Object-660x86.jpeg 660w\" sizes=\"(max-width: 921px) 100vw, 921px\" \/><\/p>\n<p><strong>Tenant ID<\/strong><\/p>\n<p>In multi-tenant environments, identifying the tenant associated with a particular user is essential for personalized experiences and data management. The Host object includes properties for retrieving the tenant ID, enabling developers to implement tenant-specific functionalities with ease.<\/p>\n<p>Example :<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-37423\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/4Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"743\" height=\"115\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/4Power-Apps-using-Host-Object.jpeg 607w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/4Power-Apps-using-Host-Object-300x46.jpeg 300w\" sizes=\"(max-width: 743px) 100vw, 743px\" \/><\/p>\n<p><strong>Host Version<\/strong><\/p>\n<p>The Host Version property allows us to identify the specific version of the Power Apps hosting environment. This information is crucial for ensuring compatibility with the platform and leveraging the latest features and capabilities available<strong>. <\/strong><\/p>\n<p>Example<strong> :<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-37422\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/5Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"741\" height=\"141\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/5Power-Apps-using-Host-Object.jpeg 604w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/5Power-Apps-using-Host-Object-300x57.jpeg 300w\" sizes=\"(max-width: 741px) 100vw, 741px\" \/><\/p>\n<p><strong>Scenario<\/strong><\/p>\n<p>Our form can be accessible only on iPhone devices and Edge browsers. So, we want to some notification on Android devices that this form is only available for iPhones. We&#8217;ve accessed the Host Object and implemented a condition to verify whether the user&#8217;s device is an Android. If the condition evaluates to true, we&#8217;ll provide a notification indicating that this feature is exclusive to iPhones.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-37421\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/6Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"990\" height=\"133\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/6Power-Apps-using-Host-Object.jpeg 990w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/6Power-Apps-using-Host-Object-300x40.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/6Power-Apps-using-Host-Object-768x103.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/6Power-Apps-using-Host-Object-660x89.jpeg 660w\" sizes=\"(max-width: 990px) 100vw, 990px\" \/><\/p>\n<p>This is how it works on Android devices now.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-37420\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/7Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"353\" height=\"721\" \/><\/p>\n<p>Additionally, we&#8217;ve included a condition to prevent the form from being displayed on other than Edge. This condition utilizes the Host.BrowserUserAgent property to identify the browser being used and ensures that the form does not work on devices where a browser other than Edge is detected.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-37419\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/8Power-Apps-using-Host-Object.jpeg\" alt=\"Power Apps using Host Object\" width=\"1345\" height=\"154\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/8Power-Apps-using-Host-Object.jpeg 1345w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/8Power-Apps-using-Host-Object-300x34.jpeg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/8Power-Apps-using-Host-Object-1024x117.jpeg 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/8Power-Apps-using-Host-Object-768x88.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/8Power-Apps-using-Host-Object-660x76.jpeg 660w\" sizes=\"(max-width: 1345px) 100vw, 1345px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-37427\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object.png\" alt=\"Power Apps using Host Object\" width=\"1920\" height=\"1003\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object.png 1920w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object-300x157.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object-1024x535.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object-768x401.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object-1536x802.png 1536w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object-660x345.png 660w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/9Power-Apps-using-Host-Object-380x200.png 380w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>The Power Apps Host object emerges as a versatile tool for developers seeking to optimize user experience and application functionality. By harnessing the wealth of client details it provides, we can create responsive, cross-platform applications that cater to diverse user environments. From personalized experiences to enhanced security and compatibility, the Host object serves as a cornerstone for elevating the capabilities of Power Apps and delivering exceptional user-centric solutions.<\/p>\n<p>In conclusion, mastering the intricacies of the Power Apps Host object empowers developers to unlock the full potential of their applications, driving user engagement, satisfaction, and success in the competitive landscape of app development.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/services\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone size-full wp-image-37295\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2024\/02\/Microsoft-Power-Platform.gif\" alt=\"Microsoft Power Platform\" width=\"800\" height=\"200\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I was working on a project where we created a Login form in the Canvas App compatible with iPhone systems only. Throughout the development phase, we faced challenges in determining the client&#8217;s specifics like browser type or device, especially since our app needed to function across specific browsers and on iPhones. Upon conducting online\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2024\/02\/how-to-know-browser-and-os-details-in-power-apps-using-host-object\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[44],"tags":[2841],"class_list":["post-37418","post","type-post","status-publish","format-standard","hentry","category-power-apps","tag-power-apps-using-host-object"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/37418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=37418"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/37418\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=37418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=37418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=37418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}