Welcome Guest Search | Active Topics | Sign In | Register

WebView: Need event for each time page changes Options
Jason R.
Posted: Friday, June 12, 2015 2:10:39 PM
Rank: Member
Groups: Member

Joined: 6/12/2015
Posts: 20
I am attaching a event handler like so:

Private Sub WebView1_LoadCompleted(sender As Object, e As EO.WebBrowser.NavigationTaskEventArgs) Handles WebView1.LoadCompleted

WebView1.EvalScript("window.onclick = function(e) {eoWebBrowser.extInvoke('jmouseclick', [event])};")

End Sub


It works great on the first page, but as soon as I click a link within the page to navigate to a different page, this Event is never called again so I cannot re-attached a event handler for the onclick.

In the MS IE WebBrowser control, their is a event called "DocumentComplete" which is fired every time after navigation completes and new page is rengdered.

How can I achieve something similar to the MS WebBrowser DocumentComplete event?
eo_support
Posted: Friday, June 12, 2015 4:04:00 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Currently LoadCompleted only fires for load request originated from your code (such as by calling LoadUrl or setting WebView.Url). It does not fire for load request originated from the user (such as user clicking a link). Our next version will fire this event for all requests. The new version is scheduled to be released next week. So please check back next week.

If you do not wish to wait, you can use JSInitCode. JSInitCode is fired for every request in every frame. So you can hook up window.onload event inside your JSInitCode, then use our JavaScript extension feature to call back into your C# side in your event handler. See here for more information:

http://www.essentialobjects.com/doc/6/advanced/jsext.aspx

Note that JSInitCode is fired for every frame. So if you have multiple frames in the window, you will see it called multiple times. As such you may want to perform additional checks in your JavaScript code to filter out the child frames (for example, by checking whether window.parent is null).

Thanks!
Jason R.
Posted: Monday, June 15, 2015 3:30:39 PM
Rank: Member
Groups: Member

Joined: 6/12/2015
Posts: 20
Thank you! JsInitCode works perfectly for what I am trying to do.
eo_support
Posted: Tuesday, June 16, 2015 10:56:38 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Great. Glad to hear that it works for you! Please feel free to let us know if there is anything else.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.