Table of Contents
WebView.EvalScript Method (String, String, Boolean)

Execute JavaScript code in a frame.

Syntax
 public object EvalScript(
   string code,
   string frameName,
   bool throwOnError
);

Parameters

code
The JavaScript code to be executed.
frameName
The name of the frame in which the code to be executed. Pass null to execute the code in the main frame.
throwOnError
Set to true if to throw an JSException when an exception occurred while executing the JavaScript code.

Return Value

The result value of the JavaScript code. See remark section for more details.

Remarks

When throwOnError is false, the JSException object will not be thrown. However you can access the exception object through LastJSException, through which you can obtain more information about the JavaScript exception.

When a JavaScript value is returned to the .NET code through this function, primitive JavaScript values are automatically converted to their corresponding .NET types. For example, a JavaScrit string will be converted to a System.String object. For non-primitive values, a value of type JSObject is returned. Note that the return value maybe of type that derives from JSObject. For example, a JavaScript array will be returned as an object array.

See here for more information on how to use this function.

See Also