Javascript library

The widget comes with a small Javascript library with the functions described here. Note that the installation code needs to be run on your page before these functions can be executed.

Toggle open/close state

To toggle the open/close state of a widget loaded on your page without having to click the phone icon toggle you can use this function:


Load/replace a widget

It is sometimes desirable to be able to replace a widget running on the page with a different widget. For instance, one use case would be that you have a Single Page Application (SPA) where you have two routes which link to two different departments. On each these routes you want to display a differently configured widget, e.g. with a different icon and different agents.

The function to load/replace a widget is this:

hiddenMode: false // Find more information on 'hiddenMode' below

Please note that the installation code needs to run once on your page before you can use the above function.

Installation Code Configuration

Hidden mode

It is possible to load the widget in a "hidden mode", which will install the widget as usual on your page, but it won't show the phone icon.

To start the widget in "hidden mode" use the default installation code with the additional parameter cwHiddenMode=true as shown in the example below:

<script type="text/javascript" src=""></script>

Instead of a user clicking on the phone icon the the Javascript function


can be used to open/close the widget programmatically, e.g. when the user clicks a button you provide on your page. This technique gives you the possibility for very customised integrations of the widget into your page.

Alternatively to using the Javascript function you can add the CSS class new-modal_responseiq to a clickable element on your page (e.g. a button or a link) and we will automatically toggle the open/close state of the widget when this element is clicked.

Did this answer your question?