<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebArchive",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WebArchive"
  },
  "title" : "WebArchive"
}
-->

# WebArchive

A WebArchive object represents a webpage that can be archived—for example, archived on disk or on the pasteboard. A WebArchive object contains the main resource, as well as the subresources and subframes of the main resource. The main resource can be an entire webpage, a portion of a webpage, or some other kind of data such as an image. Use this class to archive webpages, or place a portion of a webpage on the pasteboard, or to represent rich web content in any application.

```
class WebArchive
```

## Topics

### Initializing

[`-  initWithMainResource:subresources:subframeArchives:`](/documentation/WebKit/WebArchive/init(mainResource:subresources:subframeArchives:))

Initializes the receiver with a resource and optional subresources and subframe archives..

[`-  initWithData:`](/documentation/WebKit/WebArchive/init(data:))

Initializes and returns the receiver, specifying the initial content data.

### Getting attributes

[`mainResource`](/documentation/WebKit/WebArchive/mainResource)

The receiver’s main resource.

[`subresources`](/documentation/WebKit/WebArchive/subresources)

The receiver’s subresources, or `nil` if there are none.

[`subframeArchives`](/documentation/WebKit/WebArchive/subframeArchives)

Archives representing the receiver’s subresources or `nil` if there are none.

[`data`](/documentation/WebKit/WebArchive/data)

The data representation of the receiver.

### Constants

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

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

## See Also

  [WebKit Objective-C Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DisplayWebContent/DisplayWebContent.html#//apple_ref/doc/uid/10000164i)

## Relationships

### Conforms To

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)