I am creating an application to open a website in a c# webbrowser control, and track the elements being clicked from that website. So I chose to make a c# application with a webbrowser and on click within the website the elements being clicked are to be logged. I'm having a problem on finding the most efficient way to handle mouse click events of the website within the webbrowser.
3 methods which I found out:
- Applying a transparent panel in front of the webbrowser so that when a click is done the mouse coordinates are used to get the element inside the webbrowser and further on log it.
- Applying the logging system on document loading complete.
- Applying a timer with a very low interval to detect any clicks done within the webbrowser control.
I am using the first method but I'm having a bit of problems on hiding the transparent panel when a click is done and replicating the click, but I believe a I can find a solution to this. I chose not to use the second method because when the webbrowser is changing website the trigger event doesn't work correctly. And the 3rd method will require alot of unneeded resources to log the clicks.
Is there any suggestions on how to make the system more efficient?