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

# WebResource

A `WebResource` object represents a downloaded URL. It encapsulates the data of the download as well as other resource properties such as the URL, MIME type, and frame name.

```
class WebResource
```

## Overview

Use the [`init(data:url:mimeType:textEncodingName:frameName:)`](/documentation/WebKit/WebResource/init(data:url:mimeType:textEncodingName:frameName:)-914h4) method to initialize a newly created `WebResource` object. Use the other methods in this class to get the properties of a `WebResource` object.

## Topics

### Initializing

[`init(data:url:mimeType:textEncodingName:frameName:)`](/documentation/WebKit/WebResource/init(data:url:mimeType:textEncodingName:frameName:)-914h4)

Initializes and returns a web resource instance.

### Getting attributes

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

The receiver’s data.

[`url`](/documentation/WebKit/WebResource/url)

The receiver’s URL.

[`mimeType`](/documentation/WebKit/WebResource/mimeType)

The receiver’s MIME type.

[`textEncodingName`](/documentation/WebKit/WebResource/textEncodingName)

The receiver’s text encoding name.

[`frameName`](/documentation/WebKit/WebResource/frameName)

The name of the frame. If the receiver does not represent the contents of an entire HTML frame, this is `nil`.

## See Also

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



---

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)