> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript Loader (Deprecated)

<Warning>
  **WARNING**

  The JavaScript loader is a deprecated method of integrating widgets on a website. The loader will continue to work, but you should use the [Web Widget SDK](/connect/guides/web-sdk) instead.
</Warning>

Once you've generated a URL, you can pass that information on to a JavaScript loader provided by MX. This loader allows you to further configure your Connect Widget, including the size as well as all the supported configuration options, inside the `config` object.

It also allows you to listen for event messages that indicate loading or a successful member creation.

<Warning>
  **WARNING**

  The event messages handled by `onEvent` below allow partners to take action in their own codebase in response to events triggered within the Connect Widget’s UI. They are intended specifically to allow a partner’s code and the widget’s UI to work in concert over a single session, not to give canonical information on the state of a `member` or other information available by request to the appropriate endpoint, e.g., **read member connection status**.
</Warning>

```javascript Example theme={null}
<script src="https://atrium.mx.com/connect.js"></script>
/**
 * The reference to "atrium" is a holdover from a legacy API.
 * Nevertheless, this is still the correct source for the widget loader
 * even in the context of the Platform API.
 */

<script>
var mxConnect = new window.MXConnect({
  id: "connect-widget",
  iframeTitle: "Connect",
  /**
   * Callback that for handling all events within Connect.
   * Only called in  ui_message_version 4 or higher.
   *
   * The events called here are the same events that come through post
   * messages.
   */
  onEvent: function (type, payload) {
    console.log("onEvent", type, payload);
  },
  targetOrigin: "*",
})
</script>

```

**Parameters available for the JavaScript loader**

| Parameter | Data Type | Description                                                                                                                            | Required? |
| :-------- | :-------- | :------------------------------------------------------------------------------------------------------------------------------------- | :-------- |
| `config`  | Object    | This object allows you to set additional parameters to load the MX Connect Widget in a specific state.                                 | No        |
| `height`  | String    | Desired height of the iframe. Defaults to 600 pixels.                                                                                  | No        |
| `id`      | String    | The `id` of the DOM element you'll load the widget into.                                                                               | Yes       |
| `onEvent` | Function  | A general event handler. Only available with `ui_message_version: 4` or higher, which is the required version for the MX Platform API. | No        |
| `width`   | String    | Desired width of the iframe. Defaults to 100% of the parent.                                                                           | No        |
| `url`     | String    | A URL for the widget provided as a response to the `POST` request above.                                                               | Yes       |
