Welcome Guest Search | Active Topics | Sign In | Register

Html on mouse click Options
Marianoir
Posted: Friday, February 17, 2017 4:24:45 PM
Rank: Newbie
Groups: Member

Joined: 2/17/2017
Posts: 3
Hi, question:

In c# webbrowser you have an event onclick mouseup etc over the html document , when you click on it, you can get the htmlelement where you have clicked.

I saw in another question here in the forum that there is no such function in eo.webbrowser, but if i get the position of the mouse, is there a way to get the element where im clicking??

thanks!
eo_support
Posted: Saturday, February 18, 2017 9:59:19 AM
Rank: Administration
Groups: Administration

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

You would need to use JavaScript to collect such information. The key design principles for EO.WebBrowser are:

1. Everything outside of the WebView, you do it in your .NET code;
2. Everything inside the WebView, you do it with JavaScript;
3. EO.WebBrowser provides mechanism for you to communicate between your .NET code and the JavaScript code in the page;

For example, you can do the following in your case:

1. Use WebView.JSInitCode to inject JavaScript code into the page to handle click event;
2. Inside your JavaScript click event handler, you can collect whatever information you want to collect (mouse position, which element was clicked, etc);
3. You can then use the JavaScript extension feature provided by EO.WebBrowser to pass this information to the .NET side:

https://www.essentialobjects.com/doc/webbrowser/advanced/jsext.aspx

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
Marianoir
Posted: Sunday, February 19, 2017 8:27:02 AM
Rank: Newbie
Groups: Member

Joined: 2/17/2017
Posts: 3
I will try!! 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.