Welcome Guest Search | Active Topics | Sign In | Register

WebBrowser DOM events Options
Bodmoor
Posted: Monday, September 4, 2017 9:53:29 AM
Rank: Member
Groups: Member

Joined: 9/4/2017
Posts: 10
Hello,

I've been trying to implement features I have been using with the standard webbrowser available to me in windows forms. I have an htmleditor, tinyMCE, that has certain quirks requiring me to trap the keydown event. Since I can access the document, I can hook events that occur on the document. Using the EO browser however, I can get the window, and the document, even the HTML but in wrapped objects preventing me from hooking to any events.

My question is, do I need to inject javascript that hooks to the keydown event, then register an extension that I can call from my injected hooks to route this event to my application? This would seem like a lot of work.

I case of the keydown event, I can also cancel the event, preventing a keypress when I am using the standard webbrowser control.

Is it possible to hook into events occurring on the html document, embedded in an iframe or not?

To further complicate the case, I have embedded the EO browser on a usercontrol that I have interfaced to use in MS Access. But the routing to Access is no problem, so if I can get the javascript event into my .net usercontrol I'm all set.
eo_support
Posted: Monday, September 4, 2017 11:40:27 AM
Rank: Administration
Groups: Administration

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

Yes. You can use WebView.JSInitCode for that. You only need to set this on the WebView object and the same code will be executed inside all frames inside that WebView. You can then hook up event handler inside your JSInitCode and calls into the .NET side from your handler if needed.

You should exercise extreme caution when you re-route the events though. This is because the browser engine in fact runs inside a child process and rerouting events between two processes can be both tricky and messy. Additionally, please keep in mind that the actual event is actually never being redirected. After calling your JavaScript extension function, the original event inside the browser engine will still continue be processed based on whatever event model the browser engine/page uses. So I would recommend you only reroute events that you are interested in on the .NET side instead of rerouting everything.

Thanks!
Bodmoor
Posted: Tuesday, September 5, 2017 2:39:00 AM
Rank: Member
Groups: Member

Joined: 9/4/2017
Posts: 10
Hello,

Thanks for your reply.

Yes I agree that I should only reroute specific events when needed. The javascript event will have to be cancelled, and if necessary recalled in some manner from the .net code.

Thanks for your confirmation and further explanation. I will get to work with this.
eo_support
Posted: Tuesday, September 5, 2017 8:28:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
You are very welcome. Please feel free to let us know if you run into anything else.


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.