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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
