Difference between iOS Universal Links and Android App Links
iOS Universal Links and Android App Links are both verified deep link methods. Universal Links are iOS-specific and use the `.well-known/apple-app-site-association` endpoint with appID format `$DEVELOPMENT_TEAM_ID.$APP_BUNDLE_ID`. App Links are Android-specific and use the `.well-known/assetlinks.json` endpoint with package name and certificate fingerprints. Both require HTTPS and domain verification but use different endpoint paths and credential formats.
Desktop deep links on Linux and Windows
On Linux and Windows, deep links are delivered as command-line arguments to a new app process. To ensure a single app instance receives the event, integrate the deep-link plugin with the single-instance plugin by adding the `deep-link` feature to `tauri-plugin-single-instance` and registering the single-instance plugin before the deep-link plugin.
Deep link configuration in tauri.conf.json
Deep links are configured in `tauri.conf.json > plugins > deep-link`. Mobile configuration includes an array with scheme, host, pathPrefix, and appLink fields. Desktop configuration includes a schemes array. Example mobile custom scheme: `{"scheme": ["ovi"], "appLink": false}` registers `ovi://*`. Example App Link: `{"scheme": ["https"], "host": "your.website.com", "pathPrefix": ["/open"], "appLink": true}` registers `https://your.website.com/open/*`. Desktop example: `{"schemes": ["something", "my-tauri-app"]}`.
Listening for deep links in JavaScript
In JavaScript, use `getCurrent()` from `@tauri-apps/plugin-deep-link` to check if the app was opened via deep link at startup. Use `onOpenUrl()` callback to listen for deep link events when the app is running. Both functions return the received URLs. Import with `import { getCurrent, onOpenUrl } from '@tauri-apps/plugin-deep-link'` or use `window.__TAURI__.deepLink` when `withGlobalTauri` is true.
Listening for deep links in Rust
In Rust, use the `DeepLinkExt` trait from `tauri_plugin_deep_link`. Call `app.deep_link().get_current()?` in setup to check if the app was opened via deep link. Call `app.deep_link().on_open_url()` with a closure to listen for deep link events. The `on_open_url` closure receives an event with an `urls()` method.
Registering deep links at runtime in Rust
On Linux and Windows, use `app.deep_link().register("scheme-name")?` to register a deep link scheme at runtime. Use `app.deep_link().register_all()?` with the condition `#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]` to register all statically configured deep links at runtime, which is useful for development and AppImage installations.
Testing deep links on Windows
To test deep links on Windows, open the URL in a browser using `<scheme>://url` format or run `start <scheme>://url` in the terminal.
Testing deep links on Linux
To test deep links on Linux, open the URL in a browser using `<scheme>://url` format or run `xdg-open <scheme>://url` in the terminal.
Testing deep links on iOS
To test iOS App Links, open the `https://<host>/path` URL in a browser. For iOS simulators, use the simctl CLI command `xcrun simctl openurl booted https://<host>/path`.
Testing deep links on Android
To test Android App Links, open the `https://<host>/path` URL in a browser. For emulators, use the adb CLI command `adb shell am start -a android.intent.action.VIEW -d https://<host>/path <bundle-identifier>`.
Deep link spoofing security concern
Users can manually trigger pseudo deep links by including URLs in command-line arguments. Applications should verify that URLs match the expected format. Tauri only processes statically configured schemes; runtime-registered schemes must be manually verified using `Env::args_os`.
What deep links enable
The Deep Link plugin enables Tauri applications to be set as the default handler for URLs, allowing the application to open when a URL with a registered scheme is accessed.
Deep links platforms support
The Deep Link plugin is available on iOS, Android, macOS, Windows, and Linux platforms.
Android App Links method
Android App Links use http/https schemes with host verification. They require a server endpoint at `.well-known/assetlinks.json` that returns a JSON response in a specific format with the app bundle ID, SHA256 certificate fingerprints, and delegation permissions. The bundle ID is defined in `tauri.conf.json > identifier` with hyphens replaced by underscores. App Links provide verified URL handling.
iOS Universal Links method
iOS Universal Links use https schemes with host verification. They require a server endpoint at `.well-known/apple-app-site-association` that returns a JSON response in a specific format. The response must include appIDs in the format `$DEVELOPMENT_TEAM_ID.$APP_BUNDLE_ID` where the development team ID comes from `tauri.conf.json > tauri > bundle > iOS > developmentTeam` or the `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable. The Content-Type header must be `application/json` and the endpoint must be served over HTTPS.
Deep Link Rust API get_current
In Rust, use `app.deep_link().get_current()?` to detect whether the app was opened via a deep link. Call this during setup. The return value gets updated every time on_open_url is triggered. Access via the DeepLinkExt trait.
Deep Link Rust API on_open_url
In Rust, use `app.deep_link().on_open_url(|event| { ... })` to listen for deep links when they trigger the app while running. Access the URLs via `event.urls()`. This is available via the DeepLinkExt trait.
Deep Link Rust API register
In Rust on Linux and Windows, use `app.deep_link().register('scheme-name')?` to associate a scheme with your application at runtime. After the first execution, the OS will open scheme-name://* URLs with your application.
Deep Link Rust API register_all
In Rust, use `app.deep_link().register_all()?` to force register all statically configured deep links at runtime. This is useful for development on Linux and Windows and ensures deep links are registered for development mode.
Deep Link multiple URLs in event
The open URL event is triggered with a list of URLs to be compatible with the macOS API for deep links, but in most cases the app will only receive a single URL.
Desktop deep link testing on Windows
To trigger a deep link on Windows, either open scheme://url in a browser or run `start scheme://url` in the terminal.
Desktop deep link testing on Linux
To trigger a deep link on Linux, either open scheme://url in a browser or run `xdg-open scheme://url` in the terminal.
iOS deep link testing with simulator
To trigger a deep link on iOS simulator, use the simctl CLI: `xcrun simctl openurl booted https://<host>/path`.
iOS deep link testing in browser
To trigger an app link on iOS, open the https://<host>/path URL in the browser.
Android deep link testing with emulator
To trigger a deep link on Android emulator, use the adb CLI: `adb shell am start -a android.intent.action.VIEW -d https://<host>/path <bundle-identifier>`.
Android deep link testing in browser
To trigger an app link on Android, open the https://<host>/path URL in the browser.
Deep Link single instance plugin integration
To integrate Deep Link with the single instance plugin on desktop, add the 'deep-link' feature to tauri-plugin-single-instance in Cargo.toml with the target specification for macOS, Windows, and Linux. Register the single instance plugin first before the deep link plugin.
Deep Link fake URL mitigation
Users can trigger a fake deep link by including the URL as a command line argument. Tauri matches the command line argument against configured schemes to mitigate this, but developers should validate that the URL matches the expected format. Only schemes that were statically configured are automatically handled; schemes registered at runtime must be manually checked using Env::args_os.
Deep Link desktop installation requirement
Deep links are only triggered for installed applications on desktop. On Linux and Windows, you can circumvent this during development using the register_all Rust function, which registers all configured schemes to trigger the current executable.
Deep Link AppImage Linux registration
Installing an AppImage that supports deep links on Linux requires an AppImage launcher to integrate with the operating system. Using the register_all function allows deep link support out of the box without external tools. When an AppImage is moved to a different location, the deep link registration becomes invalid since it uses an absolute path to the executable.
Deep Link macOS runtime registration limitation
Registering deep links at runtime is not possible on macOS. Deep links can only be tested on the bundled application, which must be installed in the /Applications directory.
Deep Link permissions configuration
To enable Deep Link plugin permissions, add 'deep-link:default' to the permissions array in src-tauri/capabilities/default.json. You usually also need 'core:event:default' to listen to the deep-link event.
Deep Link verify iOS Universal Link configuration
To verify if an iOS domain has been properly configured to expose app associations, run: `curl -v https://app-site-association.cdn-apple.com/a/v1/<host>` replacing <host> with the actual host.
iOS Universal Link localhost testing
To test iOS Universal Links on localhost, you can either use a self-signed TLS certificate and install it on the iOS simulator, or use services like ngrok.
Deep Link iOS development team configuration
The $DEVELOPMENT_TEAM_ID used in iOS Universal Links is defined on tauri.conf.json > bundle > iOS > developmentTeam or the TAURI_APPLE_DEVELOPMENT_TEAM environment variable.
Deep Link Android package name formatting
The $APP_BUNDLE_ID in Android App Links assetlinks.json is taken from tauri.conf.json > identifier, but with hyphens replaced by underscores for the package_name field.
Deep Link plugin purpose
The Deep Link plugin sets your Tauri application as the default handler for a URL, enabling deep linking functionality across desktop and mobile platforms.
Deep Link plugin installation automatic
The Deep Link plugin can be installed automatically using the command: npm run tauri add deep-link (or yarn run tauri add deep-link, pnpm tauri add deep-link, deno task tauri add deep-link, bun tauri add deep-link, or cargo tauri add deep-link).
Deep Link plugin installation manual
To manually install the Deep Link plugin: (1) Run `cargo add tauri-plugin-deep-link@2.0.0` in the src-tauri folder, (2) Modify lib.rs to initialize the plugin by adding `.plugin(tauri_plugin_deep_link::init())` to the Builder chain, (3) Install JavaScript Guest bindings using `npm install @tauri-apps/plugin-deep-link` (or equivalent yarn, pnpm, deno, or bun command).
Android App Links verification setup
Android App Links require a server with a `.well-known/assetlinks.json` endpoint that returns JSON with a relation field containing 'delegate_permission/common.handle_all_urls', a target namespace of 'android_app', the package_name (tauri.conf.json identifier with - replaced by _), and a list of SHA256 certificate fingerprints of the app's signing certificates.
Android custom URI schemes for deep links
Custom URI schemes on Android (such as myapp://) do not require host verification. You declare a custom scheme without hosting files by using the scheme field in the mobile configuration and omitting the host.
iOS Universal Links verification setup
iOS Universal Links require a server with a `.well-known/apple-app-site-association` endpoint that returns JSON with an applinks object containing details array with appIDs (formatted as $DEVELOPMENT_TEAM_ID.$APP_BUNDLE_ID) and components specifying path patterns. The Content-Type header must be application/json and the endpoint must be served over HTTPS.
iOS custom URI schemes for deep links
Custom URI schemes on iOS (such as myapp://) do not require host verification or files. You declare a custom scheme under mobile configuration with 'appLink': false (or omit the field entirely). The plugin generates the appropriate CFBundleURLTypes entries in the app's Info.plist.
Desktop deep links delivery mechanism
On Linux and Windows, deep links are delivered as command line arguments to a new app process. The Deep Link plugin integrates with the single instance plugin if you prefer having a unique app instance receive the events.
Deep Link configuration location
Deep links are configured under tauri.conf.json > plugins > deep-link, where you configure mobile domains/schemes and desktop schemes to associate with your application.
Deep Link configuration custom mobile scheme
To configure a custom scheme on mobile in tauri.conf.json: under plugins.deep-link.mobile array, add an object with scheme array (e.g., ['ovi']), and set appLink to false. This registers the scheme://* pattern on Android and iOS.
Deep Link configuration App Link/Universal Link
To configure an App Link / Universal Link in tauri.conf.json: under plugins.deep-link.mobile array, add an object with scheme array containing ['https'], host field (e.g., 'your.website.com'), pathPrefix array (e.g., ['/open']), and appLink set to true. This registers https://your.website.com/open/* as an app/universal link.
Deep Link configuration desktop schemes
To configure desktop schemes in tauri.conf.json: under plugins.deep-link.desktop, add a schemes array with scheme names (e.g., ['something', 'my-tauri-app']).
Deep Link JavaScript API getCurrent
In JavaScript, use `import { getCurrent, onOpenUrl } from '@tauri-apps/plugin-deep-link'`. Call getCurrent() on app start to detect whether the app was opened via a deep link. getCurrent's return value gets updated every time onOpenUrl is triggered.
Deep Link JavaScript API onOpenUrl
In JavaScript, use `onOpenUrl((urls) => { ... })` to listen for deep links when they trigger the app while it's running. The callback receives a list of URLs.
Deep link support in Tauri 2.0
Tauri 2.0 added `tauri::RunEvent::Opened` on macOS and iOS for deep link support.