Platform features

Websites and web views on iPhone Duo

How websites and WKWebView content behave on iPhone Duo, why you should avoid device detection, and how the experimental Viewport Segments and Device Posture APIs work in Safari.

4 min readUpdated 5 sources

If you build for the web — or embed web content inside a native app via WKWebView — supporting iPhone Duo mostly comes down to standard responsive design best practices.

Don’t try to detect iPhone Duo

Apple’s engineers are explicit: there is no reliable way to fingerprint iPhone Duo from the web, and you shouldn’t try. User-Agent sniffing won’t distinguish it from other iPhones. Instead, your page sees a viewport whose dimensions can change at any time as the user opens, closes, or splits the screen — and your layout should respond just like it does when a desktop browser window resizes:1

  • Use fluid CSS layouts paired with media queries or container queries based on available width rather than device model names.
  • Re-measure on resize events or, better yet, attach a ResizeObserver to layout-critical elements.
  • When using viewport-fit=cover, pad interactive elements with env(safe-area-inset-*) and apply each side’s inset independently, since safe areas on iPhone Duo are frequently asymmetric.
  • Don’t assume orientation: portrait means a narrow mobile column — the unfolded inner display is nearly square.

Foldable web APIs are still experimental

Two W3C specifications target foldable displays:

  • Viewport Segments API: exposes the geometry of each sub-region when a viewport is divided by a fold, via CSS environment variables like env(viewport-segment-width 0 0) and media features like horizontal-viewport-segments.2
  • Device Posture API: reports whether the device is continuous (flat) or folded, via the device-posture CSS media feature and navigator.devicePosture in JavaScript.3
/* Matches only when the viewport is split side by side across a fold */
@media (horizontal-viewport-segments: 2) {
  .reader {
    display: grid;
    grid-template-columns: env(viewport-segment-width 0 0) 1fr;
    column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0));
  }
}

In iOS 27.1, Safari ships both specifications behind opt-in experimental feature flags (Settings > Apps > Safari > Advanced > Feature Flags).45 Regular users won’t have those flags enabled, and they cannot be turned on inside WKWebView.1 Treat them strictly as progressive enhancements: build your layout so it works cleanly as a single continuous viewport first, then layer segment queries on top.

Native apps hosting WKWebView

A WKWebView automatically inherits the bounds and safe-area insets of its native container. When hosted inside a standard navigation stack or split view, it resizes and updates its safe areas automatically as the device folds and unfolds. Because the W3C foldable APIs aren’t active in WKWebView, use native reserved regions if you need to position native toolbars or overlays around the web view without crossing the crease.

Sources

  1. Apple Developer Forums: A summary of the iPhone Duo Group Lab
  2. W3C: Viewport Segments API
  3. W3C: Device Posture API
  4. WebKit standards position: Viewport Segments (#327)
  5. WebKit standards position: Device Posture (#328)