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

# onOpen

Set up a callback that will be invoked when a file or URL is opened in the Pod

```ts
class BrowserPod {
  onOpen(cb: (urlOrPath: string) => void): void;
}
```

## Parameters

- **cb** (`function(urlOrPath: string) => void`) - Callback function to invoke when a file or URL is opened within the [Pod](https://browserpod.io/docs/reference/BrowserPod.md).

## Callback arguments

- **urlOrPath (`string`)** - The absolute path to the file, or URL, that was opened within the [Pod](https://browserpod.io/docs/reference/BrowserPod.md).

## Returns

`onOpen` does not return a value.

## Notes

`onOpen` intercepts the use of the [`xdg-open`](https://linux.die.net/man/1/xdg-open) utility.
