Opening web links in apps: Custom Tabs and SFSafariViewController
Short answer: When your app needs to open a web page, such as a help article, a partner's site, a payment page or a terms page, use the system in-app browser: Custom Tabs on Android and SFSafariViewController on iOS. They show the page in a browser-grade view without sending people out of your app, share the user's existing browser sign-ins and safety features, and keep your app away from their browsing data. Use a WebView only for your own content that you need to control, and the full browser for links people will want to keep.
Three ways to show a web page
Most apps eventually need to show web content: an FAQ, a returns form, a blog post, a supplier's booking page, a privacy policy. There are three options.
1. Hand off to the browser. The link opens in Chrome or Safari. It's simple, but Google's Custom Tabs documentation calls launching the actual browser a heavy context switch for users. They leave your app and may not come back.
2. A WebView inside your app. You control everything, but it's a bare rendering view. It doesn't share the user's browser cookies or saved passwords, so people have to sign in again, and you take on responsibility for security behaviours a browser normally handles.
3. The system in-app browser. Custom Tabs on Android, SFSafariViewController on iOS. A browser view slides over your app, then returns people to where they were.
For links to websites, option 3 is usually the right default.
What Custom Tabs give you on Android
Google describes Custom Tabs as a feature in Android browsers that lets apps add a customised browser experience inside the app. Benefits listed in its documentation include:
- Shared cookie jar and permissions, so users don't have to sign in again to sites they already use or re-grant permissions.
- Safe Browsing protection against dangerous sites.
- Performance options, including warming up the browser in the background and pre-loading pages.
- Branding, such as setting the toolbar colour to match your app, including in light and dark themes.
Custom Tabs are a feature supported by browsers on Android; Google notes they were first introduced in Chrome version 45. Other browsers support them too, and your app should check that a supporting browser exists, with a fallback to opening the link normally.
Google's guidance on when to use WebView instead is useful: WebView is the right choice if you're exclusively hosting your own content inside your app, or if you need to inject JavaScript into the page from your app. If your app sends people to URLs on other domains, Custom Tabs are likely a better choice.
What SFSafariViewController gives you on iOS
Apple's documentation describes SFSafariViewController as a way to let users view websites from anywhere on the internet without leaving your app. It supports Safari features such as Reader, AutoFill, Fraudulent Website Warning and content blocking.
Two privacy points from Apple matter for business apps:
- Your app can't see what happens inside it. Interactions with the page aren't visible to your app, and you can't access AutoFill data, browsing history or website data. That's reassuring for customers, and it means you don't have to handle that data.
- It must be visible. Apple says you may not hide or obscure it behind other views.
If you need to customise or interact with web content, Apple points you to WKWebView. If you need to share data between your app and Safari, such as a sign-in result, Apple points to ASWebAuthenticationSession.
Matching the tool to the job
| Link | Best option |
|---|---|
| Help centre, blog, store locator on your own website | In-app browser, or WebView if it's built for the app |
| Third-party sites, such as a courier's tracking page | In-app browser |
| Signing in with an external account | The platform's authentication session (Apple) or Google's recommended auth approach |
| Terms, privacy policy, returns form | In-app browser |
| A link the user will want later, like an article to read in full | Offer "Open in browser" too |
| A screen of your app that happens to be HTML | WebView |
Practical tips
- Keep the link experience consistent. Pick one approach for external links and use it everywhere, so people know what to expect.
- Brand it lightly. A toolbar colour that matches your app makes the transition feel natural without pretending the page is part of your app.
- Don't open your own app's deep links in a browser view. If a link points to content your app can show natively, show it natively.
- Handle the back path. Make sure closing the browser view returns people to the same place, especially mid-checkout or mid-form.
- Test sign-in flows. Shared cookies mean users who are signed in to a partner site in their browser may already be signed in inside the in-app browser on Android. Check the experience with and without an existing session.
- Measure what matters. Since you can't track activity inside the browser view, track the tap that opened it and the return.
A worked example
A hypothetical Chicago dry-cleaning chain's app opens its help pages, a courier's tracking page and its terms in a WebView. Customers complain that the courier site asks them to sign in every time, and links on the help pages open more pages inside the cramped view with no address bar. The developers switch external links to Custom Tabs on Android and SFSafariViewController on iOS, with the app's brand colour on the toolbar. The order history screen, which is HTML the team controls, stays in a WebView.
FAQ
Can I track what users do in the in-app browser?
Not inside the page from your app. Measure on the website itself if it's yours, with its own analytics.
Do these work offline?
They load web pages, so they need a connection like any browser.
Will Apple reject my app for using a WebView?
Using a WebView isn't a problem in itself. Choose the tool that fits the content.
Can I hide the address bar?
The in-app browsers are designed to show where the user is. If you need full-screen web content for your own site, look at a WebView or, on Android, a Trusted Web Activity for your own web app.
If your app's web links feel clunky or keep logging people out, tell us how they open today.