ElectronWebFrame.executeJavaScript method
ElectronWebFrame › executeJavaScript
Unofficial
Evaluatescode in the page. In the browser window some HTML APIs like requestFullScreen can only be invoked by a gesture from the user. Setting userGesture to true will remove this limitation. Signature:
executeJavaScript(code: string, userGesture?: boolean | undefined, callback?: ((result: unknown, error: Error) => void) | undefined): Promise<unknown>Parameters:
| Parameter | Type | Description |
|---|---|---|
| code | string | The code to evaluate. |
| userGesture? | boolean | undefined | Whether to treat the evaluation as being triggered by a user gesture. |
| callback? | ((result: unknown, error: Error) => void) | undefined | Called with the result of the executed code. Modeled with unknown (the upstream result type is any). |
Returns: Promise<unknown> — A promise that resolves with the result of the executed code, or is rejected if execution throws or results in a rejected promise. Modeled with unknown (the upstream type is any).