Protocol Handlers
Progressive Web Apps (PWAs) have the ability to handle web protocols, which means they can respond to specific URL schemes. For example, a PWA can register to handle mailto: links, so that clicking on an email link can open a compose window in the PWA instead of opening the default mail client.
With protocol handlers, your PWA can provide a more integrated user experience, functioning more like a native application by becoming the default handler for specific protocols on the user's device.
Overview
Protocol handlers allow your PWA to:
Handle standard protocols:
mailto,tel,sms, etc.Register custom protocols: Using the
web+prefixIntercept protocol links: Capture clicks on protocol URLs
Provide integrated experiences: Open your PWA instead of native apps
Deepen user engagement: Make your PWA the default handler
Real-world examples:
Email clients handling
mailto:linksMessaging apps handling
sms:ortel:linksMusic apps handling
web+music:linksRecipe apps handling
web+recipe:linksGame launchers handling
web+game:links
Browser Support
Chrome (Desktop)
✅ Full
Since Chrome 96
Chrome (Android)
✅ Full
Since Chrome 96
Edge (Desktop)
✅ Full
Since Edge 96
Safari
❌ Not supported
-
Firefox
❌ Not supported
-
Configuration
Basic Configuration
Complete Example
Protocol Parameter
The protocol parameter specifies the protocol scheme your PWA can handle. It must follow these rules:
Standard Protocols
Standard web protocols can be registered without any prefix:
mailto - Email addresses
Usage: <a href="mailto:user@example.com">Email Me</a>
tel - Telephone numbers
Usage: <a href="tel:+1234567890">Call Us</a>
sms - SMS messages
Usage: <a href="sms:+1234567890">Text Us</a>
Custom Protocols
Custom protocols must start with the web+ prefix:
Valid custom protocols:
Invalid custom protocols:
URL Parameter
The url parameter defines where to redirect when the protocol is triggered. The URL can include a placeholder %s that will be replaced with the protocol's argument.
Simple String Format
How it works:
User clicks:
mailto:user@example.comPWA opens:
/mail/compose?to=user@example.com
Advanced Object Format
Corresponding Symfony route:
Path Type Reference
The path_type_reference option controls URL generation:
0
Absolute URL
https://app.com/foo/bar
1
Absolute path (default)
/foo/bar
2
Relative path
../bar
3
Network path
//app.com/foo/bar
Example:
Placeholder Parameter
When you need more control over the placeholder format, you can use the placeholder parameter. The bundle will automatically format it as placeholder=%s:
How it works:
User clicks:
web+jngl:examplePWA opens:
/handle?type=example
Without placeholder (default):
User clicks:
web+jngl:examplePWA opens:
/handle?example(not ideal)
This allows you to create more semantic URL patterns for your protocol handlers.
Use Cases
1. Email Client
Handle mailto: links to compose emails in your PWA:
2. Phone Dialer
Handle tel: links for a calling app:
3. Recipe App
Handle custom web+recipe: protocol:
Sharing recipes:
4. Music Player
Handle web+music: protocol for streaming:
5. Multi-Protocol App
Support multiple protocols in one PWA:
Registration Process
1. User Installs PWA
When a user installs your PWA, the browser detects protocol handlers in the manifest.
2. Permission Request
The browser prompts the user to allow the PWA to handle specified protocols.
Chrome prompt example:
3. Default Handler
If the user allows, your PWA becomes an available handler for those protocols.
User can:
Set your PWA as the default handler
Choose on a case-by-case basis
Revoke permissions later
Testing
1. Test Protocol Links
Create test HTML page with protocol links:
2. Check Manifest in DevTools
3. Test Registration Flow
4. JavaScript Testing
User Management
Checking Permissions
Users can manage protocol handlers in browser settings:
Chrome:
Edge:
Revoking Permission
Users can remove your PWA as a protocol handler:
Open browser settings
Go to Protocol handlers / Default apps
Find your PWA
Click "Remove" or "Block"
Best Practices
1. Request Only Needed Protocols
2. Provide Clear Value
Explain why users should allow protocol handling:
3. Handle Missing Parameters
4. Sanitize Protocol Input
5. Provide Fallback
Always ensure your app works even if protocol handlers aren't available:
6. Test Across Browsers
Security Considerations
1. HTTPS Required
Protocol handlers only work over HTTPS:
2. Validate Input
Always validate and sanitize protocol arguments:
3. Prevent Open Redirects
4. Respect User Choice
Always provide an easy way for users to opt-out:
Common Issues
Protocol Handler Not Appearing
Problem: PWA doesn't appear as protocol handler option
Solutions:
Verify PWA is installed (not just bookmarked)
Check browser supports protocol handlers (Chrome/Edge only)
Ensure manifest includes
protocol_handlersClear browser cache and reinstall PWA
Check DevTools → Application → Manifest
Permission Not Requested
Problem: Browser doesn't prompt for protocol handler permission
Solutions:
User must click a protocol link first
Browser only prompts once per protocol
Check if permission was previously denied
Reset permissions in browser settings
Wrong URL Generated
Problem: Protocol handler opens wrong URL
Solutions:
Verify
%splaceholder is in URLCheck
path_type_referencevalueEnsure Symfony route exists
Check route parameters match configuration
Protocol Not Working
Problem: Clicking protocol link doesn't open PWA
Solutions:
Verify protocol format (must start with
web+for custom)Check PWA is set as default handler
Test in supported browser (Chrome/Edge)
Verify PWA is still installed
Troubleshooting
Debug Protocol Handling
Check Protocol Registration
Test Without Installation
Protocol handlers only work for installed PWAs. To test:
Install PWA first
Then click protocol links
Or test from external page/app
Related Documentation
Shortcuts - App shortcuts configuration
Start URL - URL configuration
File Handlers - Handle file types
Resources
MDN Protocol Handlers: https://developer.mozilla.org/en-US/docs/Web/Manifest/protocol_handlers
Web.dev: https://web.dev/url-protocol-handler/
Chrome Platform Status: https://chromestatus.com/feature/5680742077038592
W3C Spec: https://w3c.github.io/manifest-app-info/#protocol_handlers-member
Last updated
Was this helpful?