Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

WebKit 4 min read How-to mediumAdept

Enabling the Inspection of Web Content in Apps

WKWebView and JSContext now expose an opt-in `isInspectable` property (default false), letting released apps, not just Xcode development builds, have their web content and JavaScript contexts debugged with Safari's Web Inspector. Swift, Objective-C and C (`JSGlobalContextSetInspectable`) examples are given. Inspection can be toggled at runtime, and disabling it closes an active inspector. Unnamed JSContexts all appear as "JSContext" in the Develop menu, so each should get a `name`. Apps linked against the macOS 13.3/iOS 16.4 SDKs lose the old always-inspectable debug behavior and should guard the API with availability checks.

Assumes: WKWebView basicsiOS/macOS app development

Related posts

  • Try out your website in the spatial web

    WebKit mediumAdept

    Websites generally need no special changes to work in Safari on visionOS, which runs the same WebKit engine. To test and debug them, install the visionOS simulator via Xcode 15 or Xcode 16 beta and attach Safari's Web Inspector on macOS to it, or pair a physical Apple Vision Pro with the Mac using a one-time PIN and inspect pages remotely. Feature flags in visionOS 1.2 let developers preview WebXR and the <model> element ahead of visionOS 2.

  • WebKit Features for Safari 27.0

    WebKit mediumAdept

    Safari 27.0 ships 80 new WebKit features and 844 fixes, including a local Safari MCP server (via safaridriver --mcp) that lets coding agents like Claude Code or Codex inspect DOM, network, console and screenshots. Customizable select via appearance: base-select gains redesigned UA default styles, plus ::picker-icon, ::checkmark and <selectedcontent>. Other additions include the <model> element on iOS, iPadOS and macOS, immersive environments on visionOS, scroll anchoring, sizes="auto" for lazy images, the CSS stretch keyword, and anchor positioning changes such as transform awareness and the new position-anchor default of normal. Quality work includes a new ES module loader, rebuilt CSS Zoom, subpixel inline layout and 66 SVG fixes.

  • Badging for Home Screen Web Apps

    WebKit mediumAdept

    WebKit on iOS and iPadOS 16.4 supports the W3C Badging API, but only for web apps added to the Home Screen. It is not exposed in Safari or WKWebView. Badges appear only after the user grants notification permission, and users can still hide badges in Settings without the app being told. The post shows feature detection, requesting and checking notification permission, `navigator.setAppBadge()` and `clearAppBadge()`, and updating badges from a Service Worker on push events. A badge update alone does not satisfy the user-visible notification requirement, and calls from cross-origin frames are ignored.

  • WebKit Features in Safari 18.0

    WebKit mediumAdept

    Safari 18.0 ships 53 new web platform features, 25 deprecations and 209 fixes in WebKit alongside iOS 18, macOS Sequoia and visionOS 2. Notable additions include the View Transitions API, CSS Style Queries for custom properties, currentcolor and system colors in Relative Color Syntax, transitions on `display`, unprefixed `backdrop-filter`, and `content-visibility`. Web apps on Mac can now capture in-scope links and run extensions, and visionOS 2 adds WebXR immersive-vr sessions with transient-pointer input and hand tracking, plus Fullscreen API support for spatial photos and panoramas. Code samples show how to use the new CSS and JavaScript APIs.

  • Global Privacy Control (GPC) WebKit API

    WebKit mediumAdept

    iOS, iPadOS, visionOS and macOS 27 add a WebKit API that lets apps embedding WKWebView or SwiftUI's WebPage opt navigations into Global Privacy Control, the emerging standard for signalling opt-out of data sharing and cross-context targeted advertising (recognized under California's CCPA). Setting `globalPrivacyControlEnabled` on the WKWebpagePreferences returned from the navigation-policy delegate, or `isGlobalPrivacyControlEnabled` on WebPage.NavigationPreferences, enables `navigator.globalPrivacyControl` and the `Sec-GPC: 1` header for the main frame, subframes and subresources. Example delegate code is given in Swift and Objective-C so apps can wire GPC to their own user setting.

The quest for software engineering knowledge.

Look:
Layout: