2

I need to get the HTML of a website which is heavy on Javascript. When I try to do I get a receive code, but it is filled with Javascript.

Can I execute that JS after downloading and get the resulting HTML out of it?

7
  • So you're trying to capture the response from an HTTP request to a website? And did you mean "exclude the JavaScript", rather than "execute"? Commented Sep 8, 2011 at 7:07
  • The problem is, when I try to do the GET to aham...get..the website..it comes back with a lot of javascript code. I would like to execute that code, not exclude it. By executing it I would get the HTTP I want. Commented Sep 8, 2011 at 7:08
  • Most JavaScript don't output HTML but are responsible for other things, such as AJAX, animations etc. Commented Sep 8, 2011 at 7:08
  • I have used this tutorial here: csharp-station.com/HowTo/HttpWebFetch.aspx Commented Sep 8, 2011 at 7:09
  • 1
    @Daniel As @Al W alludes to below, you need something the evaluate the JavaScript, which normally means a web browser. The WinForms libraries contain a WebBrowser control you can use (which you can create purely in code, if memory serves me right) rather than sending it to an external browser application. Commented Sep 8, 2011 at 7:14

1 Answer 1

2

The most straight forward way to do this would be to embed a WebBrowser control into a windows form and then use the DOM

C# WebBrowser control -- Get Document Elements After AJAX?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.