Skip to content
All writing ‹ Part 04 of 11 · Mobile Debugging: When There Is No DevTools
Engineering · 3 min read

Three Ways an iOS App Can Open a Link

Inside an iOS app, one ad link can open in three places: the app's own browser, an in-app Safari window, or another app. How to tell which one from proof.

On the web, a link opens in a tab. On iOS, inside an app, the same link can open in three different places. To debug it, you must first know which one.

The three places

Three places a tapped link can open A tap on an ad goes to the app's own browser, an in-app Safari window, or another app. Tap on an ad inside an app 1 The app's own browser WKWebView 2 Safari window in the app SFSafariViewController 3 Another app Safari, or the advertised app
One tap, three possible places. Each place leaves different proof, so find out which one before you debug.

The host app picks the place, not the ad (Same Code, Put It in an App, and It Behaves Differently).

How to tell which one

The proof comes from two recorders: the HAR (a file of every request and reply, see Record the Phone Traffic, Then Read It) and the device log (the phone’s system log). UA means User-Agent, the header where the browser names itself.

Place What the user sees Name in iOS Proof
1 The app’s own browser Still in the app, no address bar WKWebView The HAR has the request. The UA has no Safari/
2 A Safari window inside the app A “Done” button on top. The app cannot read this page SFSafariViewController The HAR has the request. The UA has Safari/604.1. The device log has SFBrowserServiceViewController
3 Another app The screen switches to another app The iOS service lsd opens it The HAR has only the new app’s own traffic. The device log has the lsd line “opening app link”

In the third case, iOS hands the URL to the app that claims the domain. See Where Did It Fail? The Device Log and the Network Log Each See Half.

Read two headers, not one

Sec-Fetch-Mode: navigate tells you that a page opened. It does not tell you where. The UA does:

  • Safari adds Version/18.6 ... Safari/604.1.
  • A plain WKWebView stops at Mobile/15E148.

Android has the same three places. Its app links are listed in /.well-known/assetlinks.json, and adb logcat shows the app start.

Sec-Fetch-Mode says that a page opened. The User-Agent says where.

References


Related: see why the host app decides how a page behaves. Learn to record the phone traffic and read it. Then find out what the device log sees that the HAR misses. Back to the series overview.

↑↓ navigate ↵ open esc close