---
title: "onPortal"
source: "https://browserpod.io/docs/reference/BrowserPod/onPortal"
---

# onPortal

Set up a callback that will be invoked when a Portal is created

```ts
class BrowserPod {
  onPortal(cb: ({ url: string, port: number }) => void): void;
}
```

## Parameters

- **cb** (`function({url: string, port: number}) => void`) - Function to invoke each time a [Portal](https://browserpod.io/docs/understanding-browserpod/portals.md) is created, once per listening port.

## Callback arguments

- **url (`string`)** - The URL at which the Portal is accessible.
- **port (`number`)** - The port inside the Pod that the server is listening on.

## Returns

`onPortal` does not return a value.

> Portals are only created on the Edge network, which requires an API key.
