Reputation: 833
I want to download the final html source from other website(after all javascript code run). For examlple i have a part jquery inside remote html file look like:
$(document).ready(function () {
$('#dynamic').after('some dynamic content when page load');
});
And this is in my c# code:
var client = new WebClient();
client.Encoding = System.Text.Encoding.UTF8;
var content = client.DownloadString("http://myremotedomain.com/");
And also use WebRequest and WebResponse to do the same thing like above. And even use Webbrowser in window form from this link Use webbrowser control in asp.net
But i can not get the final html source , the result just raw html without affected by JavaScript.
Upvotes: 0
Views: 1766
Reputation: 37456
You will need a headless browser that actually runs the javascript. Check this other post with a list of headless browsers with a C# API. Headless browser for C# (.NET)?
Upvotes: 1