The OpenD Programming Language

ICoreWebView2.ExecuteScript

Run JavaScript code from the javascript parameter in the current top-level document rendered in the WebView. The result of evaluating the provided JavaScript is used in this parameter. The result value is a JSON encoded string. If the result is undefined, contains a reference cycle, or otherwise is not able to be encoded into JSON, then the result is considered to be null, which is encoded in JSON as the string "null".

\> [!NOTE]\n\> A function that has no explicit return value returns undefined. If the script that was run throws an unhandled exception, then the result is also "null". This method is applied asynchronously. If the method is run after the NavigationStarting event during a navigation, the script runs in the new document when loading it, around the time ContentLoading is run. This operation executes the script even if ICoreWebView2Settings::IsScriptEnabled is set to FALSE.

\snippet ScriptComponent.cpp ExecuteScript

interface ICoreWebView2
HRESULT
ExecuteScript

Meta