I am using the TIdHTTP component to fetch web pages. Works fine for the main page. But it does not retrieve content generated by embedded javascript code. A good example are the pages which allow users to add comments via disqus.
Here is an example
In the scenario the TIdHTTP.Get method does not get the comments down on the bottom of the page.
Is there anyway this could be done with the Indy component or any other native component?
I have experimented using TWebBrowser OLE control. But I prefer to use native delphi code.
IdHTTP will not execute JavaScripts, as IdHTTP is NOT a browser. You would need to introduce a JavaScript executor to your application to execute the scripts from the retrieved HTML source as a browser would.
Your example is about displaying google analytics stats… is this what you’re trying to do in your application? If so, you’re being foolish (without meaning to be offensive) trying to hack it together using a pre-rendered result.
Google Analytics provides an API specifically so you can harvest information using HTTP calls. Once that information is retrieved, you can then display it using native Delphi components and code in any imaginative or original way you desire.
Because GA provides an API, there’s no excusable reason to do it the way you appear to be attempting.