0

I have a Windows MAUI .NET 9 app which can be opened with a URI. My clients present a web page to their users, who can click on a button to request my MAUI (WinUI) app to open and do something. The URI that opens my app includes a URI to open when done, which is typically the original web page.

The issue is that I want to open the same browser (if that's what it is) that opened my app, which may not be the default browser. It is easy, of course to open a web page using Launcher.Default.OpenAsync(), but that will open with the default browser.

7
  • How is the app being opened? A browser can't typically run a local application. Commented Sep 22 at 18:18
  • @TimRoberts, The app as to create a "protocol" (name) which would be the first part of a link, e.g. mycoolapp://command&arg=something This is not the best source, but my journey started here: stackoverflow.com/questions/72606737/… Commented Sep 22 at 18:31
  • Really, even if you knew they were running Opera, how would you launch it? Commented Sep 23 at 3:27
  • Mmmm... I've found ways to know what the default browser is, and get a path to it. I think if I found out it was not Chrome, Edge, or Firefox, I'd give up. Commented Sep 23 at 17:50
  • @TimRoberts How about Proces.Start("opera.exe") ? Can we not do this anymore? Commented Sep 24 at 5:08

1 Answer 1

1

Unfortunately, this is not possible. The closest implementation I can think of is:

  1. Check if the app was activated with a URI by calling GetActivatedEventArgs() and check if the Kind property is Protocol.

  2. List running processes with Process.GetProcesses() and hope that different types of browsers are not running at the same time...

Sign up to request clarification or add additional context in comments.

1 Comment

that's a pretty inventive idea. It's too bad that this isn't supported directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.