Link to home
Start Free TrialLog in
Avatar of dudup
dudup

asked on

TWebBrowser navigate

Hi,

I am using TWebBrowser to access certain URL and then grab the content.

Do you know if we can detect the "end of transfer" of the TWebBrowser action?

Let say I am accessing http://www.example.com/ , my code is like this:

     WebBrowser1.Navigate('http://www.example.com');

But, how do I capture event if the Navigate process SUCCESS or FAIL ???

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of 2266180
2266180
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Geert G
use the event
DocumentComplete


the last OnTitleChange event
gives the Error if the page can't be found
like 'Network Error'
I personally would use ReadyState.
DocumentCompltee is best of events (fired when ReadyState is changed to 4, which means document is ready for manipulations)

Other events are:
NavigateComplete, NavigateComplete2, DownloadComplete and LoadingComplete events
(only DownloadComplete fires on error)

NavigeteComple fires sooner (I think its on ReadyState=2) and you cant access read document in that phase. But you should stop any 'Loading' animation and so on this.
>> I am using TWebBrowser to access certain URL and then grab the content

Are you working with the DOM, or just with the page content as raw text? The reason I ask is that a hosted browser may be overkill if your looking to just page scrape information. (Eg use of Indy components, etc, for perfoming an http get).

Russell


B grade and no questions/requests. tipical.

you are now th 35th asker on my blacklist which means that I will no longer answer any of your questions. you might want to read and apply the grading tips and teh FAQ and help on how to work on EE, or you might find yourself with other experts blacklisting you.

no need to reply as I've unsubscribed from this question.

ejony