---
name: "WebviewContext"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "WebviewContext"
---

## WebviewContext

> [VERSION] Base Library >= 2.21.8

> 💡 WebviewContext is bound by id to a web-view component and operates the corresponding web-view component.

### Description

WebviewContext instance (native environment), obtainable via ty.createWebviewContext

### Parameters

None


### Return Value

Type: `WebviewContext`

WebviewContext instance

#### Methods

| Method | Description |
| --- | --- |
| `postMessage` | Send a message to the web-view component |
| `reload` | Reload the web-view component |

### Examples

#### Basic usage

```ts
Page({
  onReady() {
    const webviewCtx = ty.createWebviewContext('myWebview');
    webviewCtx.postMessage({ data: { action: 'hello' } });
  },
});
```
