Set JavaScript events in WebBrowser control

Posted by Neir0 on Stack Overflow See other posts from Stack Overflow or by Neir0
Published on 2010-04-13T07:54:06Z Indexed on 2010/04/13 21:03 UTC
Read the original article Hit count: 761

Filed under:
|
|

Hi

I have a WebBrowser control and try to set onclick and href attributes on all links.

foreach (HtmlElement link in webBrowser1.Document.Links)
{
      link.SetAttribute("href", "http://www.google.com");
      link.SetAttribute("onclick", "return false;");
}

It works well. When i out source code of outer html i see that attributes was exist. But JavaScript code does not work. Why and how i can force WebBrowser control to execute javascript code?

© Stack Overflow or respective owner

Related posts about c#

Related posts about webbrowser