question

Angelru-4290 avatar image
0 Votes"
Angelru-4290 asked WenyanZhang-MSFT edited

macOS/Windows AppLinks

I have a requirement that when the user visits a website protocol with certain parameters (appname:url.com/param1/param2), the desktop application must open and read those parameters, I know that this is possible on iOS/Android, on desktop too? where can i read doc.


https://docs.microsoft.com/en-us/windows/msix/app-installer/install-parameters
https://developer.shotgridsoftware.com/af0c94ce/#registering-a-protocol-on-osx
https://stackoverflow.com/questions/68577785/how-to-make-url-protocol-to-launch-application-from-its-own-directory-instead

in Windows/macOS it would be something like this?


dotnet-maui
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

WenyanZhang-MSFT avatar image
1 Vote"
WenyanZhang-MSFT answered WenyanZhang-MSFT edited

Hello,

I know that this is possible on iOS/Android, on desktop too? where can i read doc.

Sure, For UWP platform please refer to Enable apps for websites using app URI handlers document, you could register to handle HTTP and HTTPS links in the app manifest and then associate your app and website with a JSON file, when you navigate the specific uri in the browser, it will launch the app automatically. You can get AbsolutePath from OnActivated method, then navigate to matched page with parameter.

For macOS, you could check the macOS part here : https://developer.apple.com/documentation/xcode/allowing-apps-and-websites-to-link-to-your-content#topics
I check the links in your question, CFBundleURLSchemes is suitable for macOS as well. It's similar to iOS, see: https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007899 Try to add CFBundleURLTypes in your app, and launch your app in Safari for testing.

I see the tag is dotnet-maui, you may need to invoke platform code. If you have any other issues, feel free to let me know.

Best Regards,
Wenyan Zhang


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.