Skip to main content

Interface: Webview

Displays html content, similarly to an iframe.

Properties

cspSource

readonly cspSource: string

Content security policy source for webview resources.

Defined in

packages/extension-api/src/extension-api.d.ts:1732


html

html: string

HTML contents of the webview.

This should be a complete, valid html document. Changing this property causes the webview to be reloaded.

Defined in

packages/extension-api/src/extension-api.d.ts:1709


onDidReceiveMessage

readonly onDidReceiveMessage: Event<unknown>

Fired when the webview content posts a message.

Webview content can post strings or json serializable objects back to an extension.

Defined in

packages/extension-api/src/extension-api.d.ts:1716


options

options: WebviewOptions

Content settings for the webview.

Defined in

packages/extension-api/src/extension-api.d.ts:1701

Methods

asWebviewUri()

asWebviewUri(localResource): Uri

Convert a uri for the local file system to one that can be used inside webviews.

Parameters

localResource: Uri

Returns

Uri

Defined in

packages/extension-api/src/extension-api.d.ts:1726


postMessage()

postMessage(message): Promise<boolean>

Post a message to the webview content.

Parameters

message: unknown

Returns

Promise<boolean>

Defined in

packages/extension-api/src/extension-api.d.ts:1721