> For the complete documentation index, see [llms.txt](https://docs.win32.run/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.win32.run/developers/3rd-party-apps.md).

# 3rd-party apps

Users can install 3rd-party webapp via the Installer (it's on the desktop)

Developers who want their existing webapps to interact with win32 filesystem can do it with ease. It's simple, just adding a few lines of code to your existing webapps to pick, read & and write files.

Internally, 3rd-party webapps on win32.run are embedded inside [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe). In order to render your webapp, the `X-Frame-Options` header should not to be set.

Just open the Installer on win32.run desktop, fetch and install your webapp. If it works, then you're good to go.

*If you can't locate the Installer on the desktop, you might find it in the Start Menu.*

### Installation

### NPM

```sh
npm i win32-run-api
```

### Or Script Tag

```html
<script src="https://win32.run/js/api/0.js"></script>
```

### Initialization

3rd-party webapps communicate with win32 through [window.postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage), therefore you should instantiate Win32 class when the window object is available. i.e. `onMount` in Svelte, `componentDidMount` in React.

But for whatever reason you can't, just put the initialization where you see fit. The communication channel will be setup later when it can.

```javascript
let win32 = new Win32();
```

## Check if your webapp is running on win32.run

To check if your webapp is running on win32.run (as compared to running in its own browser tab)

```javascript
win32.is_it() //returns a Boolean
```

You can use it to update the UI and logic of your webapp accordingly. Of course this method can't be run during server side rendering.
