How to detect Hololens on Edge web browser

Sébastien Perin 36 Reputation points
2023-05-04T12:00:34.5933333+00:00

So far the Edge user agent on Hololens was not containing "Win64; x64". Since Edge version 112.0.1722.58 (may be earlier) it does, and now the user agents of Edge on Windows Desktop and Edge in Hololens are exactly the same (despite the version numbers).

Before that I was able to distinct Edge web browser running on Hololens, so it has allowed me to trigger the launch of my of my UWP Hololens application through a custom URL protocol .

So I'm desperately looking for a way to detect I'm running on Hololens from the Edge web browser, presumably by querying some data through the javascript API of the web browser.

The deprecated navigator.platform javascript API returns "Win32" on Edge for Hololens and Edge for Windows Desktop. And the new API navigator.userAgentData.platform is equal to "Windows" for both platforms.
I've searched and test the WebXR API to see if something can tell me that the device is Hololens but I didn't find anything. However even if that information exists, that would probably require to request a WebXR session and I don't want to do that.

Anyone who has a solution for this would be my hero.

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,144 questions
HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
382 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sébastien Perin 36 Reputation points
    2023-05-04T15:50:20.27+00:00

    Apparently there is a sec-ch-ua-platform-version HTTP header which has a match with the Windows "Settings > System > About > Edition" and version. platformVersion for Windows are documented here. Apparently platformVersion equals 12.0.0 for "Windows Holographic for Business" which is the current Hololens 2 Windows edition. I do not know about Hololens 1 but since platformVersion 11 is not documented it may be 11.0.0. More details on User Agent Client hints in Edge doc and Mozilla doc.

    1 person found this answer helpful.