Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello.

I want to make a little example with winform
webbrowser
control altering visible text already loaded from arbitrary url.
Retrieving text is no problem, but I cannot figure out how to change visible text content shown in control.

As far as I found out, the only way to apply changes to control is calling Refresh(), but this makes whole page reload from remote url. To not download from url I need to call Navigate() for an blank page, but this is not what I intended(maintaining everything but touch a little existing text & update to screen).

Without that, all attempts accessing
InnerText
or
InnerHtml
through Document, GetElement, DomDocument made no change despite MSDN.

What I'm seeking for is simplest way to replace some texts in loaded webbrowser document, not html structure or script elements.

I'll thank you with any help.

What I have tried:

webBrowser1.Navigate("about:blank");
webBrowser1.Document.OpenNew(false);
webBrowser1.Document.Body.InnerText = "AA";
webBrowser1.Refresh();

and so on
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900