Ismail
Ismail

Reputation: 644

How do I render .NET WebBrowser's modified DOM to HTML?

I have a .NET web browser and through DOM I am making certain changes in the page's elements

such as:

Title and changing inner text of some of elements by ID.

Now all this works fine and I can call the document's individual elements to make sure changes were made.

Webrowser.Body.Getelementbyid("id") <--- I can see changes

Webbrowser.Document.Title <---- I can see changes

But if I go to top level and view the HTML like

Webbrowser.DocumentText <--- I do not see any changes

Purpose is to save all the HTML after making necessary changes.

Upvotes: 1

Views: 425

Answers (1)

Paul Sasik
Paul Sasik

Reputation: 81479

You actually can't. You're trying to force the web browser control to be a designer and that won't happen.

This is because the browser does not apply your DOM changes to the HTML and reinterprets. All your changes are in-memory. Seeing those changes reflected in the HTML constitutes a feature provided by HTML designers, and the .NET web browser is just a browser, not a designer.

Upvotes: 1

Related Questions