Skip to main content

Interface: Webview

Defined in: packages/extension-api/src/extension-api.d.ts:2032

Displays html content, similarly to an iframe.

Properties​

cspSource​

readonly cspSource: string

Defined in: packages/extension-api/src/extension-api.d.ts:2067

Content security policy source for webview resources.


html​

html: string

Defined in: packages/extension-api/src/extension-api.d.ts:2044

HTML contents of the webview.

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


onDidReceiveMessage​

readonly onDidReceiveMessage: Event<unknown>

Defined in: packages/extension-api/src/extension-api.d.ts:2051

Fired when the webview content posts a message.

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


options​

options: WebviewOptions

Defined in: packages/extension-api/src/extension-api.d.ts:2036

Content settings for the webview.

Methods​

asWebviewUri()​

asWebviewUri(localResource): Uri

Defined in: packages/extension-api/src/extension-api.d.ts:2061

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

Parameters​

localResource​

Uri

Returns​

Uri


postMessage()​

postMessage(message): Promise<boolean>

Defined in: packages/extension-api/src/extension-api.d.ts:2056

Post a message to the webview content.

Parameters​

message​

unknown

Returns​

Promise<boolean>