From 665b15bd419ab7c317c88a96bf696e56dd6b893e Mon Sep 17 00:00:00 2001 From: Niek Deibus Date: Wed, 15 Jan 2025 18:31:58 +0100 Subject: [PATCH] chore: Updated protocol-activation doc to reflect standard-protocols on WASM --- doc/articles/features/protocol-activation.md | 35 ++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/doc/articles/features/protocol-activation.md b/doc/articles/features/protocol-activation.md index 58d11ba2176a..3688b9d35641 100644 --- a/doc/articles/features/protocol-activation.md +++ b/doc/articles/features/protocol-activation.md @@ -46,24 +46,53 @@ If your target framework is Android 12, you must also add `Exported = true` to t ### WASM -WASM implementation uses the [`Navigator.registerProtocolHandler` API](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler). This has several limitations for the custom scheme: +WASM implementation uses the [`Navigator.registerProtocolHandler` API](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler). + +This has several limitations when using a custom scheme: - The custom scheme's name must begin with `web+` - The custom scheme's name must include at least 1 letter after the `web+` prefix - The custom scheme must have only lowercase ASCII letters in its name. +You can also use one of the following supported schemes instead: + +- `bitcoin` +- `ftp` +- `ftps` +- `geo` +- `im` +- `irc` +- `ircs` +- `magnet` +- `mailto` +- `matrix` +- `mms` +- `news` +- `nntp` +- `openpgp4fpr` +- `sftp` +- `sip` +- `sms` +- `smsto` +- `ssh` +- `tel` +- `urn` +- `webcal` +- `wtai` +- `xmpp` + To register the custom theme, call the WASM-specific `Uno.Helpers.ProtocolActivation` API when appropriate to let the user confirm URI handler association: ```csharp #if __WASM__ Uno.Helpers.ProtocolActivation.RegisterCustomScheme( - "web+myscheme", + "web+myscheme", new System.Uri("http://localhost:55838/"), "Can we handle web+myscheme links?"); #endif ``` -The first argument is the scheme name, the second is the base URL of your application (it must match the current domain to be registered successfully), and the third is a text prompt, which will be displayed to the user to ask for permission. +The first argument is the scheme name, the second is the base URL of your application (it must match the current domain to be registered successfully), and the third is a text prompt, which will be displayed to the user to ask for permission (this does not work on all browsers e.g. edge). When a link with the custom scheme gets executed, the browser will navigate to a your URL with additional `unoprotocolactivation` query string key, which will contain the custom URI. Uno internally recognizes this query string key and executes `OnActivated` appropriately.