Windows 应用商店 - 带脚本的浏览器控件

Windows Store App - Browser Control with script

我们需要在我们的 Windows 商店应用程序中支持基于 UI 的某些第三方 HTML5 的托管。

标准的 WebView 控件没有提供我们需要的东西。我们需要:

我们也将在 UWP 应用程序中需要它

To allow script to execute a callback in the XAML page and get a return value

Call functions in the web page and get DOM objects back

WebView 有一个 InvokeScriptAsync(String, IIterable) 方法。您可以将此方法与 JavaScript eval 函数一起使用,以使用特定参数从当前加载的 HTML 执行指定的脚本函数,并使用 [=20] 中的 window.external.notify =] 事件处理程序使用 WebView.ScriptNotify 事件通知应用程序。

Get the document Ready event

您可以选择 DOMContentLoaded and NavigationCompleted 活动。