Safari Developer Library

Developer

SafariContentBrowserTabProxy Class Reference

Options
Deployment Target:

On This Page

SafariContentBrowserTabProxy

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.

Inheritance


  • SafariContentBrowserTabProxy

Conforms To


Not Applicable

Import Statement


Not Applicable Not Applicable

Availability


Available in Safari 5.0 and later.
  • Dispatches a canLoad message to the browser window tab.

    Declaration

    JavaScript

    void 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.

    Availability

    Available in Safari 5.1 and later.

  • Dispatches a message to the browser window tab.

    Declaration

    JavaScript

    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.

  • Sets the user info to the appropriate context information.

    Declaration

    JavaScript

    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.