Arun
Arun

Reputation: 3456

How to get website content of a webbrowser in windows phone?

I am developing a windows phone 7 application. I am using webbrowser control in my application. I want to get the HTML code of the content that I am loading in the webbrowser control. I need to parse the HTML content to do someother functions. So how can I get the HTML code of the content that I am displaying in the webbrowser control ?. Please help.

Thanks

Upvotes: 0

Views: 1596

Answers (3)

rajesh neupane
rajesh neupane

Reputation: 21

You can use the SaveToString() method.

Lets say we've WebBrowser name as webBrowser1.

string htmlContent=webBrowser1.SaveToString();

Thanks

Upvotes: 2

jack moseley
jack moseley

Reputation: 429

You can use the SaveAsString() Method on the WebBrowser control, and that will give you the HTML of the page currently set as the source.

Upvotes: 1

Igor Ralic
Igor Ralic

Reputation: 15006

You could perhaps get the source of webbrowser control by getting the webbrowser.Source property.

Then when you have it (source, url), you can download it using WebClient

See here for an example of using WebClient for downloading HTML

How can I download HTML source in C#

Upvotes: 0

Related Questions