IFrameEvaluateScriptAsync Method |
Version 130.1.90
Execute some Javascript code in the context of this WebBrowser, and return the result of the evaluation
in an Async fashion
Namespace: CefSharpAssembly: CefSharp (in CefSharp.dll) Version: 129.0.110.0 (129.0.110.0)
Syntax Task<JavascriptResponse> EvaluateScriptAsync(
string script,
string scriptUrl = "about:blank",
int startLine = 1,
TimeSpan? timeout = null,
bool useImmediatelyInvokedFuncExpression = false
)
Task<JavascriptResponse^>^ EvaluateScriptAsync(
String^ script,
String^ scriptUrl = L"about:blank",
int startLine = 1,
Nullable<TimeSpan> timeout = nullptr,
bool useImmediatelyInvokedFuncExpression = false
)
Parameters
- script String
- The Javascript code that should be executed.
- scriptUrl String (Optional)
- is the URL where the script in question can be found, if any.
- startLine Int32 (Optional)
- is the base line number to use for error reporting.
- timeout NullableTimeSpan (Optional)
- The timeout after which the Javascript code execution should be aborted.
- useImmediatelyInvokedFuncExpression Boolean (Optional)
- When true the script is wrapped in a self executing function.
Make sure to use a return statement in your javascript. e.g. (function () { return 42; })();
When false don't include a return statement e.g. 42;
Return Value
TaskJavascriptResponseA Task that can be awaited to perform the script execution
See Also