刷新webbrowser内容

时间:2015-11-17 10:39:15

标签: c# jquery webbrowser-control

我有带WebBrowser控件的Windows窗体应用程序。我有DocumentCompleted事件处理程序,它修改文档内部html:

public void Inject(string element, string contents)
{
    var browser = webBrowser;
    if (browser != null && browser.Document != null && browser.Document.Body != null)
    {
        HtmlElement htmlElement = browser.Document.GetElementById(element);
        if (htmlElement != null)
        {
            htmlElement.InnerHtml = contents;
        }
    }
}

我有另一种方法:

$("#divisionId").load("path_to_html_page");

我用这个方法在现有页面内注入html页面(变量&#34;内容&#34;)。这就像jquery&#34; load&#34;:<script type="text/javascript"> $(function () { // some code here }); </script> 在注入的html页面中有一些javascript代码:

htmlElement.InnerHtml = contents;

执行$scope.clickcall = function () { $http({ method: 'GET', url: '/notify/notification.html' }).then(function successCallback(response) { //Do what ever you want with returned data// console.log(response); }); }; 时,仅加载html标记,但不执行文档就绪功能。如何手动调用此函数或使WebBrowser刷新其修改的内容以执行此功能?

0 个答案:

没有答案
相关问题