Class: Frame

Frame

An iframe represents an embedded html page within a parent html page. Because this embedded page has it own DOM and global JS context (which may or may not be linked to that of the parent depending on if it is considered out of the root domain or not), it represents a unique endpoint as an OpenFin connection. Iframes may be generated dynamically, or be present on initial page load and each non CORS iframe has the OpenFin API injected by default. It is possible to opt into cross origin iframes having the API by setting api.iframe.crossOriginInjection to true in a window's options. To block all iframes from getting the API injected you can set api.frame.sameOriginInjection to false.

In order to be able to directly address this context for eventing and messaging purposes, it needs a unique uuid name pairing. For OpenFin applications and windows this is provided via a configuration object in the form of a manifest URL or options object, but there is no configuration object for iframes. Just as a call to window.open outside of our Window API returns a new window with a random GUID assigned for the name, each iframe that has the API injected will be assigned a GUID as its name, the UUID will be the same as the parent window's.

The fin.desktop.Frame namespace represents a way to interact with iframes as well as facilitates discovery of current context (iframe or main window) as well as the ability to listen for frame-specific events.

Synchronous Methods
Asynchronous Methods

Constructor

new Frame()

Methods

(static) getCurrent() → {Object}

Get a reference to the current frame

Tutorials:
Returns:

Frame object

Type
Object

(static) wrap(uuid, name) → {Object}

Gets a reference to the specified frame. The frame does not have to exist

Parameters:
Name Type Description
uuid string

uuid of the frame you want to wrap

name string

name of the frame you want to wrap

Tutorials:
Returns:

Frame

Type
Object

addEventListener(topic, listener, callbackopt, errorCallbackopt)

Adds a listener to the referenced frame. The events are 'connected' and 'disconnected'

Parameters:
Name Type Attributes Description
topic string

the event to listen for

listener function

call when the event is fired

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method succeeds fails.

Tutorials:

getInfo(callbackopt, errorCallbackopt) → {fin.desktop.Frame~FrameInfo}

Returns a frame info object for the represented frame

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails.

Tutorials:
Returns:
Type
fin.desktop.Frame~FrameInfo

getParentWindow(callbackopt, errorCallbackopt) → {fin.desktop.Frame~FrameInfo}

Returns a frame info object representing the window that the referenced iframe is currently embedded in

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method succeeds fails.

Tutorials:
Returns:
Type
fin.desktop.Frame~FrameInfo

removeEventListener(callbackopt)

Removes a listener from the referenced frame

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

Tutorials:

Type Definitions

FrameInfo

Information regarding the referenced frame

Type:
  • object
Properties:
Name Type Description
uuid string

Uuid of referenced frame

name string

Name of referenced frame

entityType string

Either 'window', 'iframe', or 'unknown'

parent object

object containing the uuid and name of the parent frame