Class

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

@interface WebFrame : NSObject

Overview

Each WebFrame also has a WebDataSource object that manages the loading of frame content. You use the loadRequest: 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 findFrameNamed: 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

- initWithName:webFrameView:webView:

Initializes the receiver with a frame name, web frame view, and controlling web view.

Loading Content

- loadRequest:

Connects to a given URL by initiating an asynchronous client request.

- reload

Reloads the initial request passed as an argument to loadRequest:.

- reloadFromOrigin

Performs an end-to-end revalidation using cache-validating conditionals if possible.

- stopLoading

Stops any pending loads on the receiver’s data source, and those of its children.

- loadAlternateHTMLString:baseURL:forUnreachableURL:

Loads alternate content for a frame whose URL is unreachable.

- loadHTMLString:baseURL:

Sets the main page contents and base URL.

- loadData:MIMEType:textEncodingName:baseURL:

Sets the main page contents, MIME type, content encoding, and base URL.

- loadArchive:

Loads an archive into the web frame.

Getting the Data Source

dataSource

The committed data source.

provisionalDataSource

The provisional data source, or nil if either a load request is not in progress or a load request has completed.

Getting Related Frames and Views

parentFrame

The web frame’s parent web frame.

childFrames

The frames of the web frame’s immediate children.

frameView

The web frame’s view object.

webView

The view object that manages the web frame.

Finding Frames

- findFrameNamed:

Returns a web frame that matches the given name.

name

The web frame’s name.

Getting DOM Objects

DOMDocument

The web frame’s DOM document.

frameElement

The web view’s DOM frame element.

globalContext

The global JavaScript execution context for bridging between the WebKit and JavaScriptCore C API.

javaScriptContext

The frame's global JavaScript execution context.

windowObject

The JavaScript window object.

Relationships

Inherits From

See Also

Working with Frames (Legacy)

WebDataSource

WebDataSource encapsulates the web content to be displayed in a web frame view. A WebDataSource object has a representation object, conforming to the WebDocumentRepresentation protocol, that holds the data in an appropriate format depending on the MIME type. You can extend WebKit to support new MIME types by implementing your own view and representation classes, and specifying the mapping between them using the registerViewClass:representationClass:forMIMEType: WebView class method.

Deprecated
WebFrameView

WebFrameView objects and their subviews display the web content contained in a frame. You never create instances of WebFrameView directly—WebView objects create and manage a hierarchy of WebFrameView objects, one for each frame. WebFrameView objects use a scroll view whose document view conforms to the WebDocumentView protocol.

Deprecated