<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebViewConfiguration",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebViewConfiguration"
  },
  "title" : "WKWebViewConfiguration"
}
-->

# WKWebViewConfiguration

A collection of properties that you use to initialize a web view.

```
@MainActor class WKWebViewConfiguration
```

## Overview

A [`WKWebViewConfiguration`](/documentation/WebKit/WKWebViewConfiguration) object provides information about how to configure a [`WKWebView`](/documentation/WebKit/WKWebView) object. Use your configuration object to specify:

- The initial cookies to make available to your web content
- Handlers for any custom URL schemes your web content uses
- Settings for how to handle media content
- Information about how to manage selections within the web view
- Custom scripts to inject into the webpage
- Custom rules that determine how to render content

You create a [`WKWebViewConfiguration`](/documentation/WebKit/WKWebViewConfiguration) object in your code, configure its properties, and pass it to the initializer of your [`WKWebView`](/documentation/WebKit/WKWebView) object. The web view incorporates your configuration settings only at creation time; you cannot change those settings dynamically later.

## Topics

### Configuring the web view’s behavior

[`websiteDataStore`](/documentation/WebKit/WKWebViewConfiguration/websiteDataStore)

The object you use to get and set the site’s cookies and to track the cached data objects.

[`userContentController`](/documentation/WebKit/WKWebViewConfiguration/userContentController)

The object that coordinates interactions between your app’s native code and the webpage’s scripts and other content.

[`processPool`](/documentation/WebKit/WKWebViewConfiguration/processPool)

The object that coordinates the processes the web view uses to render its web content and execute scripts.

[`applicationNameForUserAgent`](/documentation/WebKit/WKWebViewConfiguration/applicationNameForUserAgent)

The app name that appears in the user agent string.

[`limitsNavigationsToAppBoundDomains`](/documentation/WebKit/WKWebViewConfiguration/limitsNavigationsToAppBoundDomains)

A Boolean value that indicates whether the web view limits navigation to pages within the app’s domain.

[`upgradeKnownHostsToHTTPS`](/documentation/WebKit/WKWebViewConfiguration/upgradeKnownHostsToHTTPS)

A Boolean value that indicates whether the web view should automatically upgrade supported HTTP requests to HTTPS.

### Configuring the web view’s preferences

[`preferences`](/documentation/WebKit/WKWebViewConfiguration/preferences)

The object that manages the preference-related settings for the web view.

[`defaultWebpagePreferences`](/documentation/WebKit/WKWebViewConfiguration/defaultWebpagePreferences)

The default preferences to use when loading and rendering content.

### Adding handlers for custom URL schemes

[`setURLSchemeHandler(_:forURLScheme:)`](/documentation/WebKit/WKWebViewConfiguration/setURLSchemeHandler(_:forURLScheme:))

Registers an object to load resources associated with the specified URL scheme.

[`urlSchemeHandler(forURLScheme:)`](/documentation/WebKit/WKWebViewConfiguration/urlSchemeHandler(forURLScheme:))

Returns the currently registered handler object for the specified URL scheme.

### Configuring the rendering behavior

[`ignoresViewportScaleLimits`](/documentation/WebKit/WKWebViewConfiguration/ignoresViewportScaleLimits)

A Boolean value that determines whether a web view allows scaling of the webpage.

[`suppressesIncrementalRendering`](/documentation/WebKit/WKWebViewConfiguration/suppressesIncrementalRendering)

A Boolean value that indicates whether the web view suppresses content rendering until the content is fully loaded into memory.

### Setting media playback preferences

[`allowsInlineMediaPlayback`](/documentation/WebKit/WKWebViewConfiguration/allowsInlineMediaPlayback)

A Boolean value that indicates whether HTML5 videos play inline or use the native full-screen controller.

[`allowsAirPlayForMediaPlayback`](/documentation/WebKit/WKWebViewConfiguration/allowsAirPlayForMediaPlayback)

A Boolean value that indicates whether the web view allows media playback over AirPlay.

[`allowsPictureInPictureMediaPlayback`](/documentation/WebKit/WKWebViewConfiguration/allowsPictureInPictureMediaPlayback)

A Boolean value that indicates whether HTML5 videos can play Picture in Picture.

[`mediaTypesRequiringUserActionForPlayback`](/documentation/WebKit/WKWebViewConfiguration/mediaTypesRequiringUserActionForPlayback)

The media types that require a user gesture to begin playing.

[`WKAudiovisualMediaTypes`](/documentation/WebKit/WKAudiovisualMediaTypes)

The media types that require a user gesture to begin playing.

### Identifying data types

[`dataDetectorTypes`](/documentation/WebKit/WKWebViewConfiguration/dataDetectorTypes)

The types of data detectors to apply to the web view’s content.

[`WKDataDetectorTypes`](/documentation/WebKit/WKDataDetectorTypes)

The data detector types.

### Setting selection granularity

[`selectionGranularity`](/documentation/WebKit/WKWebViewConfiguration/selectionGranularity)

The level of granularity with which the user can interactively select web view content.

[`WKSelectionGranularity`](/documentation/WebKit/WKSelectionGranularity)

The granularity with which the user can select and modify web view content.

### Selecting user interface directionality

[`userInterfaceDirectionPolicy`](/documentation/WebKit/WKWebViewConfiguration/userInterfaceDirectionPolicy)

The directionality of user interface elements.

[`WKUserInterfaceDirectionPolicy`](/documentation/WebKit/WKUserInterfaceDirectionPolicy)

The policy that determines the directionality of user interface elements in a web view.

### Deprecated

[`mediaPlaybackAllowsAirPlay`](/documentation/WebKit/WKWebViewConfiguration/mediaPlaybackAllowsAirPlay)

Deprecated property.

[`requiresUserActionForMediaPlayback`](/documentation/WebKit/WKWebViewConfiguration/requiresUserActionForMediaPlayback)

A Boolean value that indicates whether HTML5 videos require the user to start playing them (`true`) or whether the videos play automatically (`false`).

[`mediaPlaybackRequiresUserAction`](/documentation/WebKit/WKWebViewConfiguration/mediaPlaybackRequiresUserAction)

Deprecated property.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)