Protocol

WebUIDelegate

Web view user interface delegates implement this protocol to control the opening of new windows, augment the behavior of default menu items displayed when the user clicks elements, and perform other user interface–related tasks. These methods can be invoked as a result of handling JavaScript or other plug-in content. Delegates that display more than one web view per window, for example, need to implement some of these methods to handle that case. The default implementation assumes one window per web view, so non-conventional user interfaces might implement a user interface delegate.

Declaration

@protocol WebUIDelegate

Topics

Creating and Closing Windows

- webView:createWebViewModalDialogWithRequest:

Creates a modal window containing a web view that loads the specified request.

- webViewRunModal:

Displays a web view in a modal window.

- webView:createWebViewWithRequest:

Creates a window containing a web view to load the specified request.

- webViewClose:

Closes a web view in a window.

Moving and Resizing Windows

- webViewIsResizable:

Returns a Boolean value indicating whether a web view’s window can be resized.

- webView:setResizable:

Sets whether a web view’s window can be resized.

- webView:setFrame:

Sets the frame rectangle of a web view’s window to the specified frame size.

- webViewFrame:

Returns the frame rectangle of a web view’s window.

Moving and Resizing Content Views

- webView:setContentRect:

Sets the window’s content view frame to the specified content rectangle.

- webViewContentRect:

Returns a web view window's content rectangle.

Making Windows Key and Main

- webViewFocus:

Brings a web view’s window to the front and makes it the active window.

- webViewUnfocus:

Relinquishes focus on a web view’s window.

Ordering Windows

- webViewShow:

Displays a web view’s window and moves it to the front.

Working with the Responder Chain

- webViewFirstResponder:

Returns the first responder of the web view’s window.

- webView:makeFirstResponder:

Sets the first responder of a web view’s window to the specified view.

Handling Mouse Events

- webView:mouseDidMoveOverElement:modifierFlags:

Updates information about the element the user is mousing over.

- webView:contextMenuItemsForElement:defaultMenuItems:

Returns menu items to display in an element's contextual menu.

Opening Panels

- webView:runJavaScriptAlertPanelWithMessage:

Displays a JavaScript alert panel.

- webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:

Displays a JavaScript alert panel containing the specified message.

- webView:runJavaScriptConfirmPanelWithMessage:

Displays a JavaScript confirm panel.

- webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:

Displays a JavaScript confirmation panel with the specified message.

- webView:runJavaScriptTextInputPanelWithPrompt:defaultText:

Displays a JavaScript text input panel and returns the entered text.

- webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:

Displays a JavaScript text input panel and returns the entered text.

- webView:runOpenPanelForFileButtonWithResultListener:

Displays an open panel for a file input control.

- webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:

Displays a confirmation panel containing the specified message before a window closes.

Displaying Status Messages

- webView:setStatusText:

Sets the status message displayed by a web view’s window, if any, to the specified text.

- webViewStatusText:

Returns the current status message from a web view's window.

Managing Toolbars and the Status Bar

- webViewAreToolbarsVisible:

Returns a Boolean value indicating whether any toolbars are visible in a web view's window.

- webView:setToolbarsVisible:

Sets whether a web view's toolbars should be visible.

- webViewIsStatusBarVisible:

Returns a Boolean value indicating whether the status bar in a web view's window is visible.

- webView:setStatusBarVisible:

Sets the visibility of the status bar in a web view’s window.

Controlling Drag Behavior

- webView:dragDestinationActionMaskForDraggingInfo:

Returns a mask indicating which drag operations are allowed by the sender.

- webView:dragSourceActionMaskForPoint:

Returns a mask indicating which drag-source actions are allowed for a drag that begins at the specified location.

- webView:willPerformDragDestinationAction:forDraggingInfo:

Tells the receiver that the sending web view will perform the specified drag-destination action.

- webView:willPerformDragSourceAction:fromPoint:withPasteboard:

Tells the receiver that the sending web view will perform the specified drag-source action.

Controlling Other Behaviors

- webView:shouldPerformAction:fromSender:

Returns a Boolean value that indicates whether the action sent by the specified object should be performed.

- webView:validateUserInterfaceItem:defaultValidation:

Returns a Boolean value that indicates whether the specified user interface item is valid.

Printing

- webView:printFrameView:

Prints the contents of a web frame view.

- webViewHeaderHeight:

Returns the height of the web view’s printed page header.

- webViewFooterHeight:

Returns the height of the web view’s printed page footer.

- webView:drawHeaderInRect:

Draws the web view’s header in the specified rectangle.

- webView:drawFooterInRect:

Draws the web view’s footer in the specified rectangle.

Constants

Menu Item Tags

Tags that define the types of default menu items passed to the webView:contextMenuItemsForElement:defaultMenuItems: method.

WebDragDestinationAction

Actions that the destination object of a drag operation can perform.

WebDragSourceAction

Actions that the source object of a drag operation can perform.

Relationships

Inherits From

See Also

Setting Up a Web View (Legacy)

WebView

WebView is the core view class in the WebKit framework that manages interactions between the WebFrame and WebFrameView classes. To embed web content in your application, you just create a WebView object, attach it to a window, and send a loadRequest: message to its main frame.

Deprecated
WebPreferences

WebPreferences encapsulates the preferences you can change per WebView object. These preferences include font, text encoding, and image settings. Normally a WebView object uses the standard preferences returned by the standardPreferences class method. However, you can modify the preferences for individual WebView instances too. Use the preferencesIdentifier WebView method to change a WebView object’s preferences, or to share preferences between WebView objects. Use the autosaves method to specify if the preferences object should be automatically saved to the user defaults database.

Deprecated