---
title: WebFrame
framework: webkit
role: symbol
role_heading: Class
path: webkit/webframe
---

# WebFrame

A WebFrame object encapsulates the data displayed in a WebFrameView object. There is one WebFrame object per frame displayed in a WebView. An entire webpage is represented by a hierarchy of WebFrame objects in which the root object is called the main frame.

## Declaration

```swift
class WebFrame
```

## Overview

Overview Each WebFrame also has a WebDataSource object that manages the loading of frame content. You use the load(_:) method to initiate an asynchronous client request which will create a provisional data source. The provisional data source will transition to a committed data source once any data has been received. There are some special, predefined, frame names that you can use when referring to or finding a WebFrame. Some of the predefined frame names are: “_self”, “_current”, “_parent”, and “_top.” See findNamed(_:) for a description of their meaning. Frame names may also be specified in the HTML source, or set by clients. However, the group name is an arbitrary identifier used to group related frames. For example, JavaScript running in a frame can access any other frame in the same group. It’s up to the application how it chooses to scope related frames.

## Topics

### Initializing Frames

- [init(name:webFrameView:webView:)](webkit/webframe/init(name:webframeview:webview:).md)

### Loading Content

- [load(_:)](webkit/webframe/load(_:)-47p2s.md)
- [reload()](webkit/webframe/reload().md)
- [reloadFromOrigin()](webkit/webframe/reloadfromorigin().md)
- [stopLoading()](webkit/webframe/stoploading().md)
- [loadAlternateHTMLString(_:baseURL:forUnreachableURL:)](webkit/webframe/loadalternatehtmlstring(_:baseurl:forunreachableurl:).md)
- [loadHTMLString(_:baseURL:)](webkit/webframe/loadhtmlstring(_:baseurl:).md)
- [load(_:mimeType:textEncodingName:baseURL:)](webkit/webframe/load(_:mimetype:textencodingname:baseurl:).md)
- [load(_:)](webkit/webframe/load(_:)-6wkx6.md)

### Getting the Data Source

- [dataSource](webkit/webframe/datasource.md)
- [provisionalDataSource](webkit/webframe/provisionaldatasource.md)

### Getting Related Frames and Views

- [parent](webkit/webframe/parent.md)
- [childFrames](webkit/webframe/childframes.md)
- [frameView](webkit/webframe/frameview.md)
- [webView](webkit/webframe/webview.md)

### Finding Frames

- [findNamed(_:)](webkit/webframe/findnamed(_:).md)
- [name](webkit/webframe/name.md)

### Getting DOM Objects

- [domDocument](webkit/webframe/domdocument.md)
- [frameElement](webkit/webframe/frameelement.md)
- [globalContext](webkit/webframe/globalcontext.md)
- [javaScriptContext](webkit/webframe/javascriptcontext.md)
- [windowObject](webkit/webframe/windowobject.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Related Documentation

- [WebKit Objective-C Programming Guide](apple-archive/documentation/Cocoa/Conceptual/DisplayWebContent.md)

### Working with Frames (Legacy)

- [WebDataSource](webkit/webdatasource.md)
- [WebFrameView](webkit/webframeview.md)
- [WebFrameLoadDelegate](webkit/webframeloaddelegate.md)
