VB .net (webbrowser control) How to capture javascript events (statusbar changed/mouseclick etc.)

P

P-GPS

Guest
Hi,
I am loading a webpage in the "webbrowser" in a VB .NET
application. There are some javascript events which occur when I click
a particular button, or link etc. However, these are AJAX
applications, so on the status bar of a regular internet explorer
browser, I see "DONE" and javascript:void() being displayed before
and after clicking the button/link. The javascript basically changes
the value of a DHTML tag. I want to capture (eventually) the changed
value in the innerText of this DHTML tag.
webbrowser1.DocumentCompleted doesn't help much.
What I would like to do is to be able to capture that there is an
event which occurs. The event may be me pressing/releasing a button
which causes the javascript to run. Howver, once this event occurs, I
want to read this innerText of the DHTML tag.

I am new to VB .NET and may not have put it in the right terms. Let me
know if you need more explanation.

Thanks.
 
Re: VB .net (webbrowser control) How to capture javascript events(status bar changed/mouseclick etc.)

On Dec 14, 6:59 pm, P-GPS <premg...@gmail.com> wrote:
> Hi,
> I am loading a webpage in the "webbrowser" in a VB .NET
> application. There are some javascript events which occur when I click
> a particular button, or link etc. However, these are AJAX
> applications, so on the status bar of a regular internet explorer
> browser, I see "DONE" and javascript:void() being displayed before
> and after clicking the button/link. The javascript basically changes
> the value of a DHTML tag. I want to capture (eventually) the changed
> value in the innerText of this DHTML tag.
> webbrowser1.DocumentCompleted doesn't help much.
> What I would like to do is to be able to capture that there is an
> event which occurs. The event may be me pressing/releasing a button
> which causes the javascript to run. Howver, once this event occurs, I
> want to read this innerText of the DHTML tag.
>
> I am new to VB .NET and may not have put it in the right terms. Let me
> know if you need more explanation.
>
> Thanks.


Add Timer, for example, i was working on that kind of thing which must
update status bar on every status change, then today i added a Timer
which does what you want IIRC. (100ms interval is good by default)

Make timer enabled by default, then put the code inside timer1_tick
area.

For example to retrieve status on a status bar of webbrowser control,
add a status bar then add a timer, then the code must be like this:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
StatusBar1.Text = webbrowser1.StatusText
End Sub

Where "webbrowser1" is your control name.







 
Back
Top