Webkit.Net DocumentText not updating

465 views Asked by At

I'm currently using a WebkitBrowser for .NET component in a Win form application in order to render HTML. The application generate html code in a richtextbox and I want it to be display in the the webkit browser in real time. Here is my code:

public void Write_HTML(string html)
{                        
    HTMLTag.Text = html;            
}

This is a method call from another class in order to update the html content in the richtextbox

private void HTMLTag_TextChanged(object sender, EventArgs e)
{
    HTMLTag.Refresh();
    webKitBrowser.DocumentText = HTMLTag.Text;
}

Each time the text of the rich textbox is change I tried to set the Webkit browser html content. after this affectation the DocumentText is still empty and I cannot understand why.

The funny part is that is I go on the interface and change the contetn of the textbox then the webpart refresh accordingly but is the event is trigger by the mthod Write_HTML it doesn't work, and no idea why. Any ideas?

1

There are 1 answers

0
Regfor On

To get actual document text, you can use following:

webKitBrowser.StringByEvaluatingJavaScriptFromString("document.documentElement.innerHTML");