1

How would I launch the default browser (using LaunchUriAsync) in private mode?

Preferably some way without knowing the default browser.

If that's not possible, how can I add the argument that would effect that, assuming I know the browser? In that case, I'm not asking what that argument is, only how to add an argument to LaunchUriAsync().

ispiro
  • 26,556
  • 38
  • 136
  • 291
  • There's a [LaunchUriAsync(Uri, LauncherOptions, ValueSet)](https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher.launchuriasync#Windows_System_Launcher_LaunchUriAsync_Windows_Foundation_Uri_Windows_System_LauncherOptions_Windows_Foundation_Collections_ValueSet_) override method. Have you checked it? – Xie Steven Feb 01 '19 at 07:27
  • @XavierXie-MSFT Yes. It doesn't look helpful. – ispiro Feb 01 '19 at 12:13
  • What did you want to do by adding this parameter? – Xie Steven Feb 04 '19 at 01:59
  • @XavierXie-MSFT See https://stackoverflow.com/questions/37742175/c-sharp-open-default-browser-in-private-mode/37743087#37743087 – ispiro Feb 04 '19 at 16:25

1 Answers1

0

@ispiro I checked the code on that case. If you directly use that code in your UWP app, it's unsupported. But With the Windows 10 Anniversary Update (1607), there's launch a fulltrust process API in the Desktop Extension SDK.

So, you could first make a console application/WPF application to use that code. And make a UWP app to call the FullTrustProcessLauncher API. At the end, create a 'Windows Application Packaging Project' and add the both as Application references to the Packaging project.

Then, you need to declare the extension in the package manifest and add a reference to Desktop Extension SDK.

More information, you could check Stefanwick's blog: UWP with Desktop Extension.

Xie Steven
  • 8,544
  • 1
  • 9
  • 23