Can not open MS Edge for PDF on Hololens 2 when using local file path

I’m trying to open a PDF within a Unity app deployed to a Microsoft Hololens 2 using the MRTK. I want to use the integrated Edge Browser, that is able to load within the app and to run simulatenously. Edge by itself is also able to load pdf files. I expected using LaunchUri would open the file from a provided location.

public void Launch()
{
var absolutePath = Path.Combine(Application.persistentDataPath, _subfolder);
absolutePath = Path.Combine(absolutePath, _fileName);
#if UNITY_WSA
UnityEngine.WSA.Launcher.LaunchUri("file:///"+absolutePath, true);
#else
Application.OpenURL(absolutePath);
#endif
}

Launching the Edge Browser with a website as the string, works. Entering the file path manually into the browser window to load the pdf also works, but launching the Browser by directly providing the full path to my file, does not open any browser window. I suspect, that it doesn’t work because Edge is not setup to be the default app for PDF files, but when using the button within Edge to make it the default app, it just tells me that it failed and I can’t find any other way to achieve that. Does anyone else have an idea how I would be able to load Edge from within an Unity app and providing the path to my pdf file so it automatically loads on a button press?

I tried to access the PDF on the local file system under “Documents” and under persistentDataPath. As mentioned, the file is accessible and can be opened by Edge. Using the system File Browser to manually open the PDF from within the system automatically uses Edge and opens the file as expected, which is the behaviour I would like to copy from within Unity.
I’m using

  • Unity 2022.3.15f
  • Hololens 2 latest Update
    Win10 SDK target 10.0.19041.0

Hello I hope you could solved your question because I have the same issue in my project. I am working for weeks on this feature and maybe you can share your experience with me. Thank you!

I find your post with the solution here: https://stackoverflow.com/questions/71176849/unity-does-not-open-the-edge-browser-on-a-hololens-2-when-providing-a-pdf-file-p/74740458?noredirect=1#comment131910165_74740458