ICoreWebView2Frame2.ExecuteScript

Run JavaScript code from the javascript parameter in the current frame. The result of evaluating the provided JavaScript is passed to the completion handler. 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 before ContentLoading, the script will not be executed and the string "null" will be returned. This operation executes the script even if ICoreWebView2Settings::IsScriptEnabled is set to FALSE.

\snippet ScenarioDOMContentLoaded.cpp ExecuteScriptFrame

interface ICoreWebView2Frame2
HRESULT
ExecuteScript

Meta