<!--
{
  "documentType" : "article",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/webkit-constants",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "WebKit Constants"
}
-->

# WebKit Constants

WebKit constants affecting multiple classes.

## Topics

### WKPreview Constants

[`let WKPreviewActionItemIdentifierAddToReadingList: String`](/documentation/WebKit/WKPreviewActionItemIdentifierAddToReadingList)

Adds the item to the Reading List.

[`let WKPreviewActionItemIdentifierCopy: String`](/documentation/WebKit/WKPreviewActionItemIdentifierCopy)

Copies the item to the clipboard.

[`let WKPreviewActionItemIdentifierOpen: String`](/documentation/WebKit/WKPreviewActionItemIdentifierOpen)

Opens the item.

[`let WKPreviewActionItemIdentifierShare: String`](/documentation/WebKit/WKPreviewActionItemIdentifierShare)

Displays the Share panel options available for the item.

### WKWebsiteDataType Constants

[`let WKWebsiteDataTypeCookies: String`](/documentation/WebKit/WKWebsiteDataTypeCookies)

Cookies.

[`let WKWebsiteDataTypeDiskCache: String`](/documentation/WebKit/WKWebsiteDataTypeDiskCache)

On-disk caches.

[`let WKWebsiteDataTypeIndexedDBDatabases: String`](/documentation/WebKit/WKWebsiteDataTypeIndexedDBDatabases)

IndexedDB databases.

[`let WKWebsiteDataTypeLocalStorage: String`](/documentation/WebKit/WKWebsiteDataTypeLocalStorage)

HTML local storage.

[`let WKWebsiteDataTypeMemoryCache: String`](/documentation/WebKit/WKWebsiteDataTypeMemoryCache)

In-memory caches.

[`let WKWebsiteDataTypeOfflineWebApplicationCache: String`](/documentation/WebKit/WKWebsiteDataTypeOfflineWebApplicationCache)

HTML offline web app caches.

[`let WKWebsiteDataTypeSessionStorage: String`](/documentation/WebKit/WKWebsiteDataTypeSessionStorage)

HTML session storage.

[`let WKWebsiteDataTypeWebSQLDatabases: String`](/documentation/WebKit/WKWebsiteDataTypeWebSQLDatabases)

WebSQL databases.

### DOM Constants

[`let DOMEventException: String`](/documentation/WebKit/DOMEventException)

[`let DOMException: String`](/documentation/WebKit/DOMException)

[`let DOMRangeException: String`](/documentation/WebKit/DOMRangeException)

[`let DOMXPathException: String`](/documentation/WebKit/DOMXPathException)

[`var DOM_BAD_BOUNDARYPOINTS_ERR: DOMRangeExceptionCode`](/documentation/WebKit/DOM_BAD_BOUNDARYPOINTS_ERR)

[`var DOM_DOMSTRING_SIZE_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_DOMSTRING_SIZE_ERR)

[`var DOM_HIERARCHY_REQUEST_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_HIERARCHY_REQUEST_ERR)

[`var DOM_INDEX_SIZE_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_INDEX_SIZE_ERR)

[`var DOM_INUSE_ATTRIBUTE_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_INUSE_ATTRIBUTE_ERR)

[`var DOM_INVALID_ACCESS_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_INVALID_ACCESS_ERR)

[`var DOM_INVALID_CHARACTER_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_INVALID_CHARACTER_ERR)

[`var DOM_INVALID_EXPRESSION_ERR: DOMXPathExceptionCode`](/documentation/WebKit/DOM_INVALID_EXPRESSION_ERR)

[`var DOM_INVALID_MODIFICATION_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_INVALID_MODIFICATION_ERR)

[`var DOM_INVALID_NODE_TYPE_ERR: DOMRangeExceptionCode`](/documentation/WebKit/DOM_INVALID_NODE_TYPE_ERR)

[`var DOM_INVALID_STATE_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_INVALID_STATE_ERR)

[`var DOM_NAMESPACE_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_NAMESPACE_ERR)

[`var DOM_NOT_FOUND_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_NOT_FOUND_ERR)

[`var DOM_NOT_SUPPORTED_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_NOT_SUPPORTED_ERR)

[`var DOM_NO_DATA_ALLOWED_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_NO_DATA_ALLOWED_ERR)

[`var DOM_NO_MODIFICATION_ALLOWED_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_NO_MODIFICATION_ALLOWED_ERR)

[`var DOM_SYNTAX_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_SYNTAX_ERR)

[`var DOM_TYPE_ERR: DOMXPathExceptionCode`](/documentation/WebKit/DOM_TYPE_ERR)

[`var DOM_UNSPECIFIED_EVENT_TYPE_ERR: DOMEventExceptionCode`](/documentation/WebKit/DOM_UNSPECIFIED_EVENT_TYPE_ERR)

[`var DOM_WRONG_DOCUMENT_ERR: DOMExceptionCode`](/documentation/WebKit/DOM_WRONG_DOCUMENT_ERR)

### WebKit Constants (Legacy)

[`let WebActionButtonKey: String`](/documentation/WebKit/WebActionButtonKey)

An NSNumber object where `0` indicates the left button, `1` indicates the middle button, and `2` indicates the right button.

[`let WebActionElementKey: String`](/documentation/WebKit/WebActionElementKey)

A dictionary containing element information. See [`WebView`](/documentation/WebKit/WebView-swift.class) for a description of the key-value pairs in this dictionary.

[`let WebActionModifierFlagsKey: String`](/documentation/WebKit/WebActionModifierFlagsKey)

An unsigned number that indicates the modifier flag.

[`let WebActionNavigationTypeKey: String`](/documentation/WebKit/WebActionNavigationTypeKey)

The navigation type of the action. Can be any of the values defined in [`WebNavigationType`](/documentation/WebKit/WebNavigationType) below.

[`let WebActionOriginalURLKey: String`](/documentation/WebKit/WebActionOriginalURLKey)

The URL that initiated the action.

[`let WebArchivePboardType: String`](/documentation/WebKit/WebArchivePboardType)

The pasteboard type constant used when adding or accessing a WebArchive on the pasteboard.

[`let WebElementDOMNodeKey: String`](/documentation/WebKit/WebElementDOMNodeKey)

The DOMNode for this element.

[`let WebElementFrameKey: String`](/documentation/WebKit/WebElementFrameKey)

The WebFrame object associated with this element.

[`let WebElementImageAltStringKey: String`](/documentation/WebKit/WebElementImageAltStringKey)

An NSString of the ALT attribute of an image element.

[`let WebElementImageKey: String`](/documentation/WebKit/WebElementImageKey)

An NSImage representing an image element.

[`let WebElementImageRectKey: String`](/documentation/WebKit/WebElementImageRectKey)

An NSValue containing an NSRect, the size of an image element.

[`let WebElementImageURLKey: String`](/documentation/WebKit/WebElementImageURLKey)

An NSURL containing the location of an image element.

[`let WebElementIsSelectedKey: String`](/documentation/WebKit/WebElementIsSelectedKey)

An NSNumber used as a BOOL value to indicate whether a text element is selected or not. Zero value indicates false, true otherwise.

[`let WebElementLinkLabelKey: String`](/documentation/WebKit/WebElementLinkLabelKey)

An NSString containing the text within an anchor.

[`let WebElementLinkTargetFrameKey: String`](/documentation/WebKit/WebElementLinkTargetFrameKey)

The WebFrame object associated with the target of the anchor.

[`let WebElementLinkTitleKey: String`](/documentation/WebKit/WebElementLinkTitleKey)

An NSString containing the title of an anchor.

[`let WebElementLinkURLKey: String`](/documentation/WebKit/WebElementLinkURLKey)

An NSURL containing the location of a link if the element is within an anchor.

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebHistoryAllItemsRemoved>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebHistoryItemChanged>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebHistoryItemsAdded>

[`let WebHistoryItemsKey: String`](/documentation/WebKit/WebHistoryItemsKey)

The key to access an array containing the added or removed web history items.

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebHistoryItemsRemoved>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebHistoryLoaded>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebHistorySaved>

[`let WebKitErrorDomain: String`](/documentation/WebKit/WebKitErrorDomain)

[`let WebKitErrorMIMETypeKey: String`](/documentation/WebKit/WebKitErrorMIMETypeKey)

[`let WebKitErrorPlugInNameKey: String`](/documentation/WebKit/WebKitErrorPlugInNameKey)

[`let WebKitErrorPlugInPageURLStringKey: String`](/documentation/WebKit/WebKitErrorPlugInPageURLStringKey)

[`let WebPlugInAttributesKey: String`](/documentation/WebKit/WebPlugInAttributesKey)

The `NSDictionary` object containing all names and values of all attributes of the plug-in’s associated HTML element, as well as all names and values of the parameters to be passed to the plug-in. For example, this dictionary will contain all `PARAM` elements within an `APPLET` element. If attribute and parameter names conflict, the attributes of an element take precedence over any of its parameters. All keys and values in this dictionary must be of type `NSString`. *Required key*.

[`let WebPlugInBaseURLKey: String`](/documentation/WebKit/WebPlugInBaseURLKey)

The base URL of the document containing the plug-in’s view. *Required key*.

[`let WebPlugInContainerKey: String`](/documentation/WebKit/WebPlugInContainerKey)

An object that conforms to the `WebPlugInContainer` informal protocol. This object is used for callbacks from the plug-in to the enclosing application. If `WebPlugInContainerKey` is `nil`, no callbacks will occur.

[`let WebPlugInContainingElementKey: String`](/documentation/WebKit/WebPlugInContainingElementKey)

If an element of the page’s Document Object Model was used to specify the plug-in, this will contain that element. Otherwise, it will be `nil`.

[`let WebPlugInShouldLoadMainResourceKey: String`](/documentation/WebKit/WebPlugInShouldLoadMainResourceKey)

A Boolean value indicating whether the plug-in should load its own main resource (the `src` URL, in most cases).

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebPreferencesChanged>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewDidBeginEditing>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewDidChange>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewDidChangeSelection>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewDidChangeTypingStyle>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewDidEndEditing>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewProgressEstimateChanged>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewProgressFinished>

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/WebViewProgressStarted>

### WebKit Constants (Legacy)

[`let WebActionButtonKey: String`](/documentation/WebKit/WebActionButtonKey)

An NSNumber object where `0` indicates the left button, `1` indicates the middle button, and `2` indicates the right button.

[`let WebActionElementKey: String`](/documentation/WebKit/WebActionElementKey)

A dictionary containing element information. See [`WebView`](/documentation/WebKit/WebView-swift.class) for a description of the key-value pairs in this dictionary.

[`let WebActionModifierFlagsKey: String`](/documentation/WebKit/WebActionModifierFlagsKey)

An unsigned number that indicates the modifier flag.

[`let WebActionNavigationTypeKey: String`](/documentation/WebKit/WebActionNavigationTypeKey)

The navigation type of the action. Can be any of the values defined in [`WebNavigationType`](/documentation/WebKit/WebNavigationType) below.

[`let WebActionOriginalURLKey: String`](/documentation/WebKit/WebActionOriginalURLKey)

The URL that initiated the action.

[`let WebArchivePboardType: String`](/documentation/WebKit/WebArchivePboardType)

The pasteboard type constant used when adding or accessing a WebArchive on the pasteboard.

[`let WebElementDOMNodeKey: String`](/documentation/WebKit/WebElementDOMNodeKey)

The DOMNode for this element.

[`let WebElementFrameKey: String`](/documentation/WebKit/WebElementFrameKey)

The WebFrame object associated with this element.

[`let WebElementImageAltStringKey: String`](/documentation/WebKit/WebElementImageAltStringKey)

An NSString of the ALT attribute of an image element.

[`let WebElementImageKey: String`](/documentation/WebKit/WebElementImageKey)

An NSImage representing an image element.

[`let WebElementImageRectKey: String`](/documentation/WebKit/WebElementImageRectKey)

An NSValue containing an NSRect, the size of an image element.

[`let WebElementImageURLKey: String`](/documentation/WebKit/WebElementImageURLKey)

An NSURL containing the location of an image element.

[`let WebElementIsSelectedKey: String`](/documentation/WebKit/WebElementIsSelectedKey)

An NSNumber used as a BOOL value to indicate whether a text element is selected or not. Zero value indicates false, true otherwise.

[`let WebElementLinkLabelKey: String`](/documentation/WebKit/WebElementLinkLabelKey)

An NSString containing the text within an anchor.

[`let WebElementLinkTargetFrameKey: String`](/documentation/WebKit/WebElementLinkTargetFrameKey)

The WebFrame object associated with the target of the anchor.

[`let WebElementLinkTitleKey: String`](/documentation/WebKit/WebElementLinkTitleKey)

An NSString containing the title of an anchor.

[`let WebElementLinkURLKey: String`](/documentation/WebKit/WebElementLinkURLKey)

An NSURL containing the location of a link if the element is within an anchor.

[`extern NSString * WebHistoryAllItemsRemovedNotification;`](/documentation/WebKit/WebHistoryAllItemsRemovedNotification)

Posted when all history items have been removed from the web history.

[`extern NSString * WebHistoryItemChangedNotification;`](/documentation/WebKit/WebHistoryItemChangedNotification)

Posted by a WebHistoryItem object when the value of the history item’s title, alternate title, URL strings, or last visited interval changes.

[`extern NSString * WebHistoryItemsAddedNotification;`](/documentation/WebKit/WebHistoryItemsAddedNotification)

Posted when history items have been added to a web history.

[`let WebHistoryItemsKey: String`](/documentation/WebKit/WebHistoryItemsKey)

The key to access an array containing the added or removed web history items.

[`extern NSString * WebHistoryItemsRemovedNotification;`](/documentation/WebKit/WebHistoryItemsRemovedNotification)

Posted when items have been removed from the web history.

[`extern NSString * WebHistoryLoadedNotification;`](/documentation/WebKit/WebHistoryLoadedNotification)

Posted when web history items have been loaded from a URL.

[`extern NSString * WebHistorySavedNotification;`](/documentation/WebKit/WebHistorySavedNotification)

Posted when web history items have been saved to a URL.

[`let WebKitErrorDomain: String`](/documentation/WebKit/WebKitErrorDomain)

[`let WebKitErrorMIMETypeKey: String`](/documentation/WebKit/WebKitErrorMIMETypeKey)

[`let WebKitErrorPlugInNameKey: String`](/documentation/WebKit/WebKitErrorPlugInNameKey)

[`let WebKitErrorPlugInPageURLStringKey: String`](/documentation/WebKit/WebKitErrorPlugInPageURLStringKey)

[`let WebPlugInAttributesKey: String`](/documentation/WebKit/WebPlugInAttributesKey)

The `NSDictionary` object containing all names and values of all attributes of the plug-in’s associated HTML element, as well as all names and values of the parameters to be passed to the plug-in. For example, this dictionary will contain all `PARAM` elements within an `APPLET` element. If attribute and parameter names conflict, the attributes of an element take precedence over any of its parameters. All keys and values in this dictionary must be of type `NSString`. *Required key*.

[`let WebPlugInBaseURLKey: String`](/documentation/WebKit/WebPlugInBaseURLKey)

The base URL of the document containing the plug-in’s view. *Required key*.

[`let WebPlugInContainerKey: String`](/documentation/WebKit/WebPlugInContainerKey)

An object that conforms to the `WebPlugInContainer` informal protocol. This object is used for callbacks from the plug-in to the enclosing application. If `WebPlugInContainerKey` is `nil`, no callbacks will occur.

[`let WebPlugInContainingElementKey: String`](/documentation/WebKit/WebPlugInContainingElementKey)

If an element of the page’s Document Object Model was used to specify the plug-in, this will contain that element. Otherwise, it will be `nil`.

[`let WebPlugInShouldLoadMainResourceKey: String`](/documentation/WebKit/WebPlugInShouldLoadMainResourceKey)

A Boolean value indicating whether the plug-in should load its own main resource (the `src` URL, in most cases).

[`extern NSString * WebPreferencesChangedNotification;`](/documentation/WebKit/WebPreferencesChangedNotification)

Posted when the web preference settings are changed.

[`extern NSString * const WebViewDidBeginEditingNotification;`](/documentation/WebKit/WebViewDidBeginEditingNotification)

Posted when a web view begins any operation that changes its contents in response to user editing.

[`extern NSString * const WebViewDidChangeNotification;`](/documentation/WebKit/WebViewDidChangeNotification)

Posted when a web view performs any operation that changes its contents in response to user editing.

[`extern NSString * const WebViewDidChangeSelectionNotification;`](/documentation/WebKit/WebViewDidChangeSelectionNotification)

Posted when a web view changes its typing selection.

[`extern NSString * const WebViewDidChangeTypingStyleNotification;`](/documentation/WebKit/WebViewDidChangeTypingStyleNotification)

Posted when a web view changes its typing style.

[`extern NSString * const WebViewDidEndEditingNotification;`](/documentation/WebKit/WebViewDidEndEditingNotification)

Posted when a web view ends any operation that changes its contents in response to user editing.

[`extern NSString * WebViewProgressEstimateChangedNotification;`](/documentation/WebKit/WebViewProgressEstimateChangedNotification)

Posted by a WebView object when the estimated progress value of a load changes.

[`extern NSString * WebViewProgressFinishedNotification;`](/documentation/WebKit/WebViewProgressFinishedNotification)

Posted by a WebView object when the load has finished.

[`extern NSString * WebViewProgressStartedNotification;`](/documentation/WebKit/WebViewProgressStartedNotification)

Posted by a WebView object when a load begins, including a load that is initiated in a subframe.

### Constants

[`let WKErrorDomain: String`](/documentation/WebKit/WKErrorDomain)

String that identifies the WebKit error domain.

[`let WKWebsiteDataTypeFetchCache: String`](/documentation/WebKit/WKWebsiteDataTypeFetchCache)

[`let WKWebsiteDataTypeFileSystem: String`](/documentation/WebKit/WKWebsiteDataTypeFileSystem)

[`let WKWebsiteDataTypeHashSalt: String`](/documentation/WebKit/WKWebsiteDataTypeHashSalt)

[`let WKWebsiteDataTypeMediaKeys: String`](/documentation/WebKit/WKWebsiteDataTypeMediaKeys)

[`let WKWebsiteDataTypeSearchFieldRecentSearches: String`](/documentation/WebKit/WKWebsiteDataTypeSearchFieldRecentSearches)

[`let WKWebsiteDataTypeServiceWorkerRegistrations: String`](/documentation/WebKit/WKWebsiteDataTypeServiceWorkerRegistrations)



---

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)