WebBrowser (WinForms/WPF) - InvokeScript("eval", ...) <script>. I.e., JavaScript (, <body></body>), eval .
Windows Phone SDK/emulator, , Windows Phone WebBrowser.
, Windows Store App. , this.webBrowser.InvokeScript("setTimeout", ...), JavaScript. execScript, IE11.
async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
var tcsLoad = new TaskCompletionSource<object>();
this.webBrowser.NavigationCompleted += (s, eArgs) =>
tcsLoad.TrySetResult(Type.Missing);
this.webBrowser.NavigateToString("<body></body>");
await tcsLoad.Task;
var tcsInit = new TaskCompletionSource<object>();
this.webBrowser.ScriptNotify += (s, eArgs) =>
{
if (eArgs.Value == "initialized")
tcsInit.TrySetResult(Type.Missing);
};
this.webBrowser.InvokeScript("setTimeout",
new string[] { "window.external.notify('initialized')", "0" });
await tcsInit.Task;
this.webBrowser.InvokeScript("eval",
new string[] { "document.body.style.backgroundColor = 'yellow'" });
}
, - , WP WebBrowser . LoadCompleted WP NavigationCompleted WebBrowser.IsScriptEnabled true.