Links to the app become routes in the web app. A custom scheme’s host is the first path segment,
so myapp://orders/42 becomes /orders/42. An https link on a listed host keeps its path, so
https://app.example.com/orders/42 also becomes /orders/42. Set MapRoute to map links another way.
Topic
Details
Other links
any other scheme or host is left to the native app.
Route checks
a route must be a local page path. Routes that aren’t, including anything under /_bridge or /_host, are refused, whatever MapRoute returns.
Delivery
the page gets app.link while it’s open. DELETE /_bridge/links/pending returns the latest link and removes it. Call it at boot and on each event, so a link is acted on exactly once.
Cold start
with NavigateOnColdStart, a link that launched the app becomes the first page loaded, and is consumed.
Background
links never go to background.js.
constlinks=newLinksBridge();
asyncfunctionopenPendingLink() {
constlink=await links.consume();
if (link) router.push(link.route);
}
openPendingLink();
links.onLink(openPendingLink);
Platform setup:
Platform
Details
Android
a SingleTop main activity with ACTION_VIEW intent filters, plus assetlinks.json for https.
Apple
CFBundleURLTypes, plus the Associated Domains entitlement and apple-app-site-association for https.
maui-labs AppKit
the head overrides OpenUrls and calls AppLinks.Receive, because the launching link arrives before MauiProgram.
Windows
a protocol registration; redirect activations to the first instance for links while running.
Linux
x-scheme-handler in the .desktop file; cold starts only.