<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebResource/init(data:url:mimeType:textEncodingName:frameName:)-914h4",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WebResource(im)initWithData:URL:MIMEType:textEncodingName:frameName:"
  },
  "title" : "init(data:url:mimeType:textEncodingName:frameName:)"
}
-->

# init(data:url:mimeType:textEncodingName:frameName:)

Initializes and returns a web resource instance.

```
init!(data: Data!, url URL: URL!, mimeType MIMEType: String!, textEncodingName: String!, frameName: String!)
```

## Parameters

`data`

The download data.

`URL`

The download URL.

`MIMEType`

The MIME type of the data.

`textEncodingName`

The IANA encoding name (for example, “utf-8” or “utf-16”). This parameter may be `nil`.

`frameName`

The name of the frame. Use this parameter if the resource represents the contents of an entire HTML frame; otherwise pass `nil`.

## Return Value

An initialized web resource.

## Discussion

---

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)