WebUIDelegate Protocol Reference

(informal protocol)

Framework
/System/Library/Frameworks/WebKit.framework
Availability
Available in OS X v10.2 with Safari 1.0 and later.
Available in OS X v10.2.7 and later.
Companion guide
Declared in
WebUIDelegate.h

Overview

Web view user interface delegates implement this informal 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.

Tasks

Creating and Closing Windows

Moving and Resizing Windows

Moving and Resizing Content Views

Making Windows Key and Main

Ordering Windows

Working with the Responder Chain

Handling Mouse Events

Opening Panels

Displaying Status Messages

Managing Toolbars and the Status Bar

Controlling Drag Behavior

Controlling Other Behaviors

Printing

Instance Methods

webView:contextMenuItemsForElement:defaultMenuItems:

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

- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
Parameters
sender

The web view that sent the message.

element

A dictionary that describes the element that was clicked. See “Constants” in WebView Class Reference for information about the key-value pairs in this dictionary.

defaultMenuItems

The menu items included by default in the element’s contextual menu. See “Menu Item Tags” for values you can use to differentiate among specific menu items.

Return Value

An array of menu items to display in the element’s contextual menu.

Discussion

This method is invoked every time the user clicks the right mouse button, or control-clicks, on an element to reveal a contextual menu. The receiver typically returns a modified copy of the default menu items dictionary, adding and removing menu items as appropriate for this type of element. You can use this mechanism to remove items that are not appropriate for a particular environment or task, such as saving files to the desktop in a web kiosk. You do not need to set the actions and targets of the default items.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:createWebViewModalDialogWithRequest:

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

- (WebView *)webView:(WebView *)sender createWebViewModalDialogWithRequest:(NSURLRequest *)request
Parameters
sender

The web view that sent the message.

request

The request to load.

Return Value

The web view that is loading the specified request.

Discussion

This method is invoked when JavaScript calls window.showModalDialog. It should create a new modal window containing the web view and initially hide the window. The webViewRunModal: message is sent to the delegate to display the web view.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:createWebViewWithRequest:

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

- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request
Parameters
sender

The web view that sent the message.

request

The request to load.

Return Value

The web view that is loading the request.

Discussion

This method should begin loading the content for the specified request by sending loadRequest: to its main frame. The new window should initially be hidden. Later, a webViewShow: message is sent to the delegate of the new web view. By default, this method returns nil.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:dragDestinationActionMaskForDraggingInfo:

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

- (NSUInteger)webView:(WebView *)sender dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo
Parameters
sender

The web view that sent the message.

draggingInfo

The information object for the dragging operation.

Return Value

A mask that indicates which drag operations are allowed when content is dragged over the sending web view. (Note that the return value changed from an unsigned int to an NSUInteger in OS X v10.5.) See “Drag-Destination Actions” for a list of return values.

Discussion

This method can be invoked multiple times while content is dragged over the sending web view. When the content is dropped, the web view sends a notification (webView:willPerformDragDestinationAction:forDraggingInfo:) to the receiver.

If you do not implement this method, it returns WebDragDestinationActionAny by default.

Availability
  • Available in OS X v10.3.9 and later.
Declared In
WebUIDelegate.h

webView:dragSourceActionMaskForPoint:

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

- (NSUInteger)webView:(WebView *)sender dragSourceActionMaskForPoint:(NSPoint)point
Parameters
sender

The web view that sent the message.

point

The point at which the drag began, specified in the coordinates of the web view.

Return Value

A mask indicating which drag-source actions are allowed. (Note that the return value changed from an unsigned int to an NSUInteger in OS X v10.5.) See “Drag-Source Actions” for a list of return values.

Discussion

This method is called after the user has begun a drag from a point in a web view. This method can be invoked multiple times while content is dragged from the sending web view. When the content is dropped, the sender sends webView:willPerformDragSourceAction:fromPoint:withPasteboard: to the receiver.

If you do not implement this method, it returns (WebDragSourceActionAny & ~WebDragSourceActionLink) if the cursor is in an editable part of the web view; otherwise, it returns WebDragDestinationActionAny.

Availability
  • Available in OS X v10.3.9 and later.
Declared In
WebUIDelegate.h

webView:drawFooterInRect:

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

- (void)webView:(WebView *)sender drawFooterInRect:(NSRect)rect
Parameters
sender

The web view that sent the message.

rect

The rectangle reserved for drawing the footer.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:drawHeaderInRect:

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

- (void)webView:(WebView *)sender drawHeaderInRect:(NSRect)rect
Parameters
sender

The web view that sent the message.

rect

The rectangle reserved for drawing the header.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:makeFirstResponder:

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

- (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder
Parameters
sender

The web view that sent the message.

responder

A view in the web view’s hierarchy.

Discussion

You can ignore this message if sender is not yet attached to a window.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:mouseDidMoveOverElement:modifierFlags:

Updates information about the element the user is mousing over.

- (void)webView:(WebView *)sender mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(NSUInteger)modifierFlags
Parameters
sender

The web view that sent the message.

elementInformation

A dictionary that describes the element under the mouse, or nil. See “Constants” in WebView Class Reference for information about the key-value pairs in this dictionary.

modifierFlags

An integer bit field that indicates the modifier keys in effect during the event. See “Modifier Flags” in NSEvent Class Reference for information about possible modifiers. Note that this parameter was changed from an unsigned int to an NSUInteger in OS X v10.5.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:printFrameView:

Prints the contents of a web frame view.

- (void)webView:(WebView *)sender printFrameView:(WebFrameView *)frameView
Parameters
sender

The web view that sent the message.

frameView

The web frame view whose contents to print.

Discussion

This method is invoked when a script or a user wants to print a webpage. Typically, the delegate implements this method to prepare the web frame view content for printing. The web frame view can handle some content without intervention by the delegate. Send the documentViewShouldHandlePrint message to the web frame view to determine if it can handle printing. If this method returns YES, then the delegate can print the content by sending the printDocumentView message to the web frame view. Otherwise, the delegate can use printOperationWithPrintInfo: to get an NSPrintOperation object to print the web frame view.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:

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

- (BOOL)webView:(WebView *)sender runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
Parameters
sender

The web view that sent the message.

message

The message to display in the panel.

frame

The web frame whose JavaScript initiated this call.

Return Value

YES if the user clicked the OK button; otherwise, NO.

Discussion

Use this method to include a message in the confirmation panel in addition to the message supplied by the webpage. The confirmation panel should contain OK and Cancel buttons.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:

Displays a JavaScript alert panel containing the specified message.

- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
Parameters
sender

The web view that sent the message.

message

The message to display in the alert panel.

frame

The web frame whose JavaScript initiated this call.

Discussion

This method displays an alert panel when JavaScript code calls alert. Delegates should visually indicate that this panel comes from JavaScript. The panel should contain a single OK button. No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:

Displays a JavaScript confirmation panel with the specified message.

- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
Parameters
sender

The web view that sent the message.

message

The message to display in the confirmation panel.

frame

The web frame whose JavaScript initiated this call.

Return Value

YES if the user clicks OK; otherwise, NO.

Discussion

This method displays a confirmation panel when JavaScript code calls confirm. Delegates should visually indicate that this panel comes from JavaScript. The panel should contain an OK and a Cancel button. No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:

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

- (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WebFrame *)frame
Parameters
sender

The web view that sent the message.

prompt

The message to display in the text input panel.

defaultText

Default placeholder text to display in the text field.

frame

The web frame whose JavaScript initiated this call.

Return Value

The text entered by the user if the user clicks OK; otherwise, nil.

Discussion

This method is used to provide an alternate text input panel when JavaScript code calls prompt. Delegates should visually indicate that this panel comes from JavaScript. The panel should contain an OK and a Cancel button, and an editable text field. If you do not implement this method, a JavaScript text input panel is displayed.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webView:runOpenPanelForFileButtonWithResultListener:

Displays an open panel for a file input control.

- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id < WebOpenPanelResultListener >)resultListener
Parameters
sender

The web view that sent the message.

resultListener

See the WebOpenPanelResultListener protocol for how to set these values.

Discussion

This method uses a listener object to set the results of the open panel, instead of returning the value directly. This approach allows delegates to implement the open panel as a modal dialog. No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:runOpenPanelForFileButtonWithResultListener:allowMultipleFiles:

Displays an open panel for a file input control.

- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id < WebOpenPanelResultListener >)resultListener allowMultipleFiles:(BOOL)allowMultipleFiles
Parameters
sender

The web view that sent the message.

resultListener

See the WebOpenPanelResultListener protocol for how to set these values.

allowMultipleFiles

If YES, the open panel should allow multiple files to be selected; otherwise, it should not.

Availability
  • Available in OS X v10.6 and later.
Declared In
WebUIDelegate.h

webView:setFrame:

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

- (void)webView:(WebView *)sender setFrame:(NSRect)frame
Parameters
sender

The web view that sent the message.

frame

The frame size.

Discussion

The sender invokes this method instead of setting the window’s frame directly, allowing delegates to augment the behavior by, for example, saving the original window size before resizing as a result of JavaScript running. If you do not implement this method, the NSWindow method setFrame:display: is sent to the window that contains sender, with YES passed as the display argument.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:setResizable:

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

- (void)webView:(WebView *)sender setResizable:(BOOL)resizable
Parameters
sender

The web view that sent the message.

resizable

If YES, the web view’s window can be resized; if NO, the window is not resizable.

Discussion

By default, this method sets the window containing a web view to be resizable. If you display multiple web views in a window then your user interface delegate should implement this method to handle this special case. If you do not implement this method, the NSWindow method setShowsResizeIndicator: is sent to the window that contains sender.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:setStatusBarVisible:

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

- (void)webView:(WebView *)sender setStatusBarVisible:(BOOL)visible
Parameters
sender

The web view that sent the message.

visible

If YES, the delegate should display the status bar (if any); if NO, the delegate should hide the status bar.

Discussion

No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:setStatusText:

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

- (void)webView:(WebView *)sender setStatusText:(NSString *)text
Parameters
sender

The web view that sent the message.

text

The status message to display.

Discussion

The delegate receives this message when a JavaScript function in the web view explicitly sets the status text. No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:setToolbarsVisible:

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

- (void)webView:(WebView *)sender setToolbarsVisible:(BOOL)visible
Parameters
sender

The web view that sent the message.

visible

If YES, all toolbars (with the exception of the status bar) are shown; otherwise, all toolbars (with the exception of the status bar) are removed.

Discussion

No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webView:shouldPerformAction:fromSender:

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

- (BOOL)webView:(WebView *)sender shouldPerformAction:(SEL)action fromSender:(id)fromObject
Parameters
sender

The web view that sent the message.

action

The action to perform. See WebView Class Reference for information on actions a web view can perform.

fromObject

The object that sent the action.

Return Value

YES if the action should be performed; otherwise, NO.

Discussion

This method allows the delegate to control the web view’s behavior when action methods are invoked. For example, if the action is copy:, the delegate can return NO to perform a copy in some other way than the default.

Availability
  • Available in OS X v10.3.9 and later.
Declared In
WebUIDelegate.h

webView:validateUserInterfaceItem:defaultValidation:

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

- (BOOL)webView:(WebView *)sender validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)item defaultValidation:(BOOL)defaultValidation
Parameters
sender

The web view that sent the message.

item

The user interface item being validated.

defaultValidation

YES if the web view believes the user interface item is valid; otherwise, NO.

Return Value

YES if the specified user interface item is valid; otherwise, NO.

Discussion

See NSUserInterfaceValidations Protocol Reference and NSValidatedUserInterfaceItem Protocol Reference for more information about user interface validation. If you do not implement this method, the value of defaultValidation is used.

Availability
  • Available in OS X v10.3.9 and later.
Declared In
WebUIDelegate.h

webView:willPerformDragDestinationAction:forDraggingInfo:

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

- (void)webView:(WebView *)sender willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:(id < NSDraggingInfo >)draggingInfo
Parameters
sender

The web view that sent the message.

action

The drag-destination action to perform. See “Drag-Destination Actions” for a list of actions.

draggingInfo

The information object for the dragging operation.

Discussion

This method is invoked after the last invocation of the webView:dragDestinationActionMaskForDraggingInfo: method, when the dragged content is dropped and the sender is about to perform the destination action. No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.3.9 and later.
Declared In
WebUIDelegate.h

webView:willPerformDragSourceAction:fromPoint:withPasteboard:

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

- (void)webView:(WebView *)sender willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard
Parameters
sender

The web view that sent the message.

action

The drag-source action to perform. See “Drag-Source Actions” for a list of actions.

point

The point at which the drag began, specified in the coordinates of the web view.

pasteboard

The drag pasteboard.

Discussion

This method is invoked after the last invocation of the webView:dragSourceActionMaskForPoint: method, when the dragged content is dropped and the sender is about to perform the drag-source action. The delegate has the opportunity to modify the contents of the object on the pasteboard before completing the drag-source action. No action is taken if you do not implement this method.

Availability
  • Available in OS X v10.3.9 and later.
Declared In
WebUIDelegate.h

webViewAreToolbarsVisible:

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

- (BOOL)webViewAreToolbarsVisible:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

YES if a web view’s window has any toolbars that are currently visible (other than the status bar); otherwise, NO.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewClose:

Closes a web view in a window.

- (void)webViewClose:(WebView *)sender
Parameters
sender

The web view that sent the message.

Discussion

If you display multiple web views in a window then you might want to close only sender in your implementation. By default, this method sends the close method to the NSWindow object that contains sender.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewFirstResponder:

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

- (NSResponder *)webViewFirstResponder:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

The view or subview that currently has the input focus. It can return nil or the default first responder if the sender is not attached to a window or if another view (not in the window) has the focus.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewFocus:

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

- (void)webViewFocus:(WebView *)sender
Parameters
sender

The web view that sent the message.

Discussion

By default, this method brings a web view's window into focus. If you display multiple web views in a window then you might also want to focus the input on sender, using webView:makeFirstResponder:.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewFooterHeight:

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

- (float)webViewFooterHeight:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

The height of the web view’s printed page footer. Returns 0.0 if no space is reserved for the footer.

Discussion

The height returned by this method is used to calculate the rectangle passed to the webView:drawFooterInRect: method.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webViewFrame:

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

- (NSRect)webViewFrame:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

The frame rectangle of the web view’s window.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewHeaderHeight:

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

- (float)webViewHeaderHeight:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

The height of the web view’s printed page header. Returns 0.0 if no space is reserved for the header.

Discussion

The height returned by this method is used to calculate the rectangle passed to the webView:drawHeaderInRect: method.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webViewIsResizable:

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

- (BOOL)webViewIsResizable:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

YES if the web view’s window can be resized; otherwise, NO.

Discussion

If you display multiple web views in a window then your user interface delegate should implement this method to handle this special case.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewIsStatusBarVisible:

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

- (BOOL)webViewIsStatusBarVisible:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

YES if a web view's status bar (if any) is visible; otherwise, NO.

Discussion

If you do not implement this method, it returns NO by default.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewRunModal:

Displays a web view in a modal window.

- (void)webViewRunModal:(WebView *)sender
Parameters
sender

The web view that sent the message.

Discussion

This method should display and order front a modal window containing the specified web view. This method is invoked after the webView:createWebViewModalDialogWithRequest: method is used to create a new window.

Availability
  • Available in OS X v10.4.11 and later.
Declared In
WebUIDelegate.h

webViewShow:

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

- (void)webViewShow:(WebView *)sender
Parameters
sender

The web view that sent the message.

Discussion

This method is typically used after a call to webView:createWebViewWithRequest:, which creates a new window. The new window is not ordered to the front (or even shown) unless you implement this method.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewStatusText:

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

- (NSString *)webViewStatusText:(WebView *)sender
Parameters
sender

The web view that sent the message.

Return Value

The status message displayed in the web view’s window if one has been set with the webView:setStatusText: method; otherwise, nil.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

webViewUnfocus:

Relinquishes focus on a web view’s window.

- (void)webViewUnfocus:(WebView *)sender
Parameters
sender

The web view that sent the message.

Discussion

This method releases focus for the entire window. If you display multiple web views in a window, you might instead want to change the input focus to another view, using the webView:makeFirstResponder: method.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebUIDelegate.h

Constants

Menu Item Tags

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

enum {
   WebMenuItemTagOpenLinkInNewWindow = 1,
   WebMenuItemTagDownloadLinkToDisk,
   WebMenuItemTagCopyLinkToClipboard,
   WebMenuItemTagOpenImageInNewWindow,
   WebMenuItemTagDownloadImageToDisk,
   WebMenuItemTagCopyImageToClipboard,
   WebMenuItemTagOpenFrameInNewWindow,
   WebMenuItemTagCopy,
   WebMenuItemTagGoBack,
   WebMenuItemTagGoForward,
   WebMenuItemTagStop,
   WebMenuItemTagReload,
   WebMenuItemTagCut,
   WebMenuItemTagPaste,
   WebMenuItemTagSpellingGuess,
   WebMenuItemTagNoGuessesFound,
   WebMenuItemTagIgnoreSpelling,
   WebMenuItemTagLearnSpelling,
   WebMenuItemTagOther,
   WebMenuItemTagSearchInSpotlight,
   WebMenuItemTagSearchWeb,
   WebMenuItemTagLookUpInDictionary,
   WebMenuItemTagOpenWithDefaultApplication,
   WebMenuItemPDFActualSize,
   WebMenuItemPDFZoomIn,
   WebMenuItemPDFZoomOut,
   WebMenuItemPDFAutoSize,
   WebMenuItemPDFSinglePage,
   WebMenuItemPDFFacingPages,
   WebMenuItemPDFContinuous,
   WebMenuItemPDFNextPage,
   WebMenuItemPDFPreviousPage,
};
Constants
WebMenuItemTagOpenLinkInNewWindow

Open the link in a new window.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagDownloadLinkToDisk

Download the link to a disk.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagCopyLinkToClipboard

Copy the link to the clipboard.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagOpenImageInNewWindow

Open the image in a new window.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagDownloadImageToDisk

Download the image to disk.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagCopyImageToClipboard

Copy the image to the clipboard.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagOpenFrameInNewWindow

Open the frame in a new window.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagCopy

Copy the element to the clipboard.

Available in OS X v10.2 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagGoBack

Load the previous page.

Available in OS X v10.3.9 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagGoForward

Load the next page.

Available in OS X v10.3.9 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagStop

Stop loading the current page.

Available in OS X v10.3.9 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagReload

Reload the current page.

Available in OS X v10.3.9 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagCut

Cut the currently selected content.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagPaste

Paste the content on the clipboard onto the current selection.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagSpellingGuess

Suggest spellings for the misspelled word.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagNoGuessesFound

Indicate whether any suggested spellings for the misspelled word could be found.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagIgnoreSpelling

Ignore the misspelled word.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagLearnSpelling

Add the misspelled word to the user’s list of acceptable words.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagOther

Used when a tag for an item in the context menu can’t be determined.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagSearchInSpotlight

Search SpotLight for the current selection.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagSearchWeb

Search the web for the current selection.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagLookUpInDictionary

Look up the current selection in the Dictionary.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemTagOpenWithDefaultApplication

Open the current selection using the default application.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFActualSize

Display a PDF document at its original size.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFZoomIn

Scale up a PDF document.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFZoomOut

Scale down a PDF document.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFAutoSize

Display a PDF document at a user-specified size.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFSinglePage

Display a PDF document one page at a time.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFFacingPages

Display a PDF document two pages at a time.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFContinuous

Display all pages in a PDF document continuously, using a vertical scroll bar, if necessary.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFNextPage

Display the next page of a PDF document.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

WebMenuItemPDFPreviousPage

Display the previous page of a PDF document.

Available in OS X v10.4.11 and later.

Declared in WebUIDelegate.h.

Discussion

These tags define common actions a user might want to take with elements in a page. You can use the tags to differentiate between the different types of menu items.

Declared In
WebUIDelegate.h

Drag-Destination Actions

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

typedef enum {
   WebDragDestinationActionNone    = 0,
   WebDragDestinationActionDHTML   = 1,
   WebDragDestinationActionEdit    = 2,
   WebDragDestinationActionLoad    = 4,
   WebDragDestinationActionAny     = UINT_MAX
} WebDragDestinationAction;
Constants
WebDragDestinationActionNone

No action.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragDestinationActionDHTML

Allows DHTML (such as JavaScript) to handle the drag.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragDestinationActionEdit

Allows editable documents to be changed by the drag operation.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragDestinationActionLoad

Allows the drag operation to change the location.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragDestinationActionAny

Allows any defined action to occur.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

Availability
  • Available in OS X v10.3.9 and later.
Declared In
WebUIDelegate.h

Drag-Source Actions

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

typedef enum {
   WebDragSourceActionNone         = 0,
   WebDragSourceActionDHTML        = 1,
   WebDragSourceActionImage        = 2,
   WebDragSourceActionLink         = 4,
   WebDragSourceActionSelection    = 8,
   WebDragSourceActionAny          = UINT_MAX
} WebDragSourceAction;
Constants
WebDragSourceActionNone

No action.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragSourceActionDHTML

Allows DHTML (such as JavaScript) in the source object to initiate a drag operation.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragSourceActionImage

Allows the user to drag an image in the source object.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragSourceActionLink

Allows the user to drag a link in the source object.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragSourceActionSelection

Allows the user to drag a selection in the source object.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

WebDragSourceActionAny

Allows any defined action to occur.

Available in OS X v10.3 and later.

Declared in WebUIDelegate.h.

Availability
  • Available in OS X v10.3.9 and later.