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

# Web (JavaScript)

> Drop Dojah's hosted verification flow into any web page with the Connect widget — a single script tag, no framework required.

Drop Dojah’s hosted verification flow into any web page with the `Connect` widget — a single script, no framework required.

<Note>
  This is a **widget SDK** — it renders Dojah’s UI with your **public** key. Shared options & response events live in [Choosing an SDK](/api-reference/widget-sdks/choosing-an-sdk).
</Note>

## Install

Add the widget script to your page. Don’t use `async`/`defer` — the inline code may run before the library loads.

```html index.html theme={null}
<script src="https://widget.dojah.io/widget.js"></script>
```

## Initialize

Create a `Connect` instance with your credentials and callbacks, then open it on a click:

```js app.js theme={null}
const options = {
  app_id: "your_app_id",
  p_key: "your_public_key",
  type: "custom",
  config: { widget_id: "your_widget_id" },
  metadata: { user_id: "121" },
  onSuccess: function (response) { console.log("Success", response) },
  onError: function (err) { console.log("Error", err) },
  onClose: function () { console.log("Widget closed") },
}

const connect = new Connect(options)
document.querySelector("#button-connect").addEventListener("click", function () {
  connect.setup()
  connect.open()
})
```

`type` can be `custom`, `verification`, `identification`, or `liveness`. See [Configuration options](/api-reference/widget-sdks/choosing-an-sdk#configuration-options) and [Handling the response](/api-reference/widget-sdks/choosing-an-sdk#handling-the-response) for the full set.

## TypeScript

`Connect` is attached to `window` at runtime, so declare it to keep TypeScript happy. Add a `types/index.d.ts` file and point `compilerOptions.typeRoots` at that folder:

```ts types/index.d.ts theme={null}
export {}

declare global {
  interface Window {
    Connect: any
  }
}
```

Then instantiate it from `window`:

```ts app.ts theme={null}
const connect = new window.Connect(options)
```

## Resources

* [Widget script — widget.dojah.io/widget.js](https://widget.dojah.io/widget.js)
* [Hosted flow — identity.dojah.io](https://identity.dojah.io) · [EasyOnboard](/dashboard-guide/workflows/easyonboard)
* Framework wrappers: [React](/api-reference/widget-sdks/react) · [React Native](/api-reference/widget-sdks/react-native) · [Flutter](/api-reference/widget-sdks/flutter)
