Skip to main content

Evaluate JS on a webview (webview.eval)

Declaration

str = webview.eval(js [, id ])

Parameters

  • js
    String. The JavaScript code to execute.
  • id
    Integer. Optional. Current webview id (1 ~ 1000). Default 1.

Returns

  • str
    String. Return value produced by the executed JavaScript.

Notes

Execute a piece of JavaScript on a webview and get the string result.

Example

r = webview.eval("a = 3; b = 2; a * b;")