Safari Reference Library Apple Developer
Search

SafariContentBrowserTabProxy Class Reference

Technology area
Safari Extensions
Availability
Available in Safari 5.0 and later.

Overview

Instances of the SafariContentBrowserTabProxy class serve as proxy objects, allowing scripts injected in the web content to communicate with SafariBrowserTab objects and the rest of the extension.

The counterpart class, SafariWebPageProxy, is used to pass messages from outside the web content to the scripts injected into it.

Tasks

Sending Messages

Methods

canLoad

Dispatches a canLoad message to the browser window tab.

any canLoad (in BeforeLoadEvent event, in any message);

Parameters
event

The before-load event you are responding to.

message

The body of the message. Optional.

Discussion

Use this method to set up an observer for before-load events and call this method from the observer. Then use the return value to respond to the before-load event, permitting or blocking the resource from being loaded.

This message is sent synchronously, unlike all other messages.

dispatchMessage

Dispatches a message to the browser window tab.

void dispatchMessage (in DOMString name, in any message);

Parameters
name

The name of the message.

message

The body of the message. Optional.

Discussion

All messages except for canLoad messages are dispatched asynchronously. To send a canLoad message, you should use the canLoad method.

Availability
  • Available in Safari 5.0 and later.

setContextMenuEventUserInfo

Sets the user info to the appropriate context information.

void setContextMenuEventUserInfo (in MouseEvent event, in any userInfo);

Parameters
event

The event you are responding to.

userInfo

The context information.

Discussion

The context information in userInfo is carried along through the entire event-handling process. It enables you to provide your event handlers with contextual information, such as the user interface element with which the user interacted.

Availability
  • Available in Safari 5.0 and later.



Last updated: 2010-06-30

Did this document help you? Yes It's good, but... Not helpful...