Link Management
Mini apps run inside a WebView, so clicking external links won’t work
as expected by default. The Alien SDK intercepts external link clicks
and routes them through the host app, which opens them in the system
browser or handles them natively (e.g., mailto:, solana: URIs).
How It Works
AlienProvider enables link interception by default. External links
(different origin) are caught and sent to the host app via link:open.
Same-origin links work normally for in-app navigation.
// This just works — no extra setup needed
To disable automatic interception:
Open Modes
| Mode | Description |
|---|---|
external (default) | Opens in system browser or app handler |
internal | Opens within the Alien app (mini apps, webviews) |
React Hook
Use useLinkInterceptor only if you disabled interceptLinks on the
provider and want to enable it in specific components, or if you need
a different openMode.
function App() {
useLinkInterceptor({ openMode: 'external' });
return (
<div>
<a href="https://example.com">Opens in browser</a>
<a href="https://alien.app/miniapp/other-app">Opens in browser</a>
</div>
);
}With internal mode:
function App() {
useLinkInterceptor({ openMode: 'internal' });
return (
<a href="https://alien.app/miniapp/other-app">
Opens inside Alien app
</a>
);
}Options
| Option | Type | Default | Description |
|---|---|---|---|
openMode | 'external' | 'internal' | 'external' | How to open links |
Bridge API
enableLinkInterceptor
For non-React apps, use the bridge function directly. Returns a cleanup function.
const disable = enableLinkInterceptor({ openMode: 'external' });
// Later, to stop intercepting:
disable();Interception rules:
- Ignores clicks with modifier keys (Ctrl, Meta, Shift, Alt)
- Ignores right-clicks and non-primary button clicks
- Ignores links with
downloadattribute - Ignores
javascript:andblob:protocols - Allows same-origin links through for normal navigation
- Intercepts all other external links
link:open
Open a URL programmatically, without relying on link interception.
// Open in system browser
send('link:open', { url: 'https://example.com' });
// Open a Solana URI
send('link:open', { url: 'solana:...' });
// Send an email
send('link:open', { url: 'mailto:hi@example.com' });
// Open another mini app inside Alien
send('link:open', {
url: 'https://alien.app/miniapp/other-app',
openMode: 'internal',
});Payload
{
url: string;
openMode?: 'external' | 'internal';
}This is a fire-and-forget method — no response event.
Version Requirements
The link:open method is available since contract version 0.1.3.
Link interception depends on this method internally.
const { supported } = useIsMethodSupported('link:open');Next Steps
- Clipboard — Read and write to the system clipboard
- Haptic Feedback — Haptic feedback
- Payments — Accept payments
- Bridge Reference — Full bridge API reference