Contents

WKWebsiteDataStore

An object that manages cookies, disk and memory caches, and other types of data for a web view.

Declaration

@MainActor class WKWebsiteDataStore

Overview

Use a WKWebsiteDataStore object to configure and manage web site data. Specifically, use this object to:

  • Manage cookies that your web site uses

  • Learn about the types of data that websites store

  • Remove unwanted web site data

Create a data store object and assign it to the websiteDataStore property of a WKWebViewConfiguration object before you create your web view.

By default, WKWebViewConfiguration uses the default data store returned by the default() method, which saves website data persistently to disk.

To implement private browsing, create a nonpersistent data store using the nonPersistent() method instead.

To implement profile browsing, create a persistent data store using the init(forIdentifier:) method, passing an identifier that you use to identify the data store.

Topics

Creating a data store object

Finding data stores

Inspecting data store properties

Retrieving a cookie store

Retrieving specific types of data

Removing specific types of data

Removing a data store

Initializers

Instance Properties

Instance Methods

See Also

Web data management