You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

What is flock.js?

Widgets can use flock.js to communicate with their host Flock client. flock.js can only be used from within widgets inside Flock. It is not supported independently inside a browser

It is available at:

Some of the things that you can do with flock.js are:

  • Use the currently opened widget to open another widget. For eg launch a modal widget from a sidebar widget
  • Launch the browser
  • Close the current widget (only applicable for modal widgets)

NoteWhen opening a widget or launching the browser with context, the assoicated event that is passed to the URL is client.widgetAction.

How do I use it?

Include flock.js in your widget via a script tag in the HTML.

        <script src="/path/to/flock.js"></script>

flock.js provides a global object, flock, whose methods can be invoked by your widget app to be able to talk to the Flock host client.


The following methods are available on the flock object.

flock.openWidget(url, desktopType[, moblileType])

This method opens a widget. 

  • url. The URL that should be opened.
  • desktopType. Can be either 'modal' or 'sidebar'.
  • mobileType. Can only be 'modal', which is also the default.

flock.openBrowser(url[, sendContext])

This method launches a browser. 

  • url. The URL that should be opened.
  • sendContext. If false, then Flock just opens the link in the browser without passing any context to it.


Closes the widget within which this method was called.