Wednesday, May 8, 2013

GeckoFX DocumentText similar to Webbrowser Control (C#)

In a traditional webbrowser control, you can get the page source like this:
Code:
string pageSource = webbrowser1.DocumentText; 
However, in GeckoFX webbrowser, there's no DocumentText property.
A workaround is to get the InnerHtml property of html tag using the code below:
Code:
string pageSource = string.empty;   
 if (!string.IsNullOrEmpty(this.Document.GetElementsByTagName("html")[0].InnerHtml))  
     pageSource = this.Document.GetElementsByTagName("html")[0].InnerHtml; 
Cheers!

0 comments:

Post a Comment