Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
1,157
Widok
0
12/01/2020 5:06 pm
Topic starter
detect mouse click on link, a href
1 Answer
0
12/01/2020 5:07 pm
Topic starter
private void web_LoadCompleted(object sender, NavigationEventArgs e) { //web - name of webbrowser component HTMLDocument doc = (HTMLDocument)web.Document; HTMLDocumentEvents2_Event htmlEvents = (HTMLDocumentEvents2_Event)doc; htmlEvents.onclick += new HTMLDocumentEvents2_onclickEventHandler(htmlEvents_onclick); } private bool htmlEvents_onclick(IHTMLEventObj pEvtObj) { var html_element = (pEvtObj.srcElement as IHTMLElement); var html_ahref = (html_element as IHTMLAnchorElement); try { MessageBox.Show(html_ahref.href); } catch (Exception) { } return true; }