# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.win32.run/developers/3rd-party-apps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
