Welcome Guest Search | Active Topics | Sign In | Register

How to change html content on WebView by programmatically after render Options
yleung
Posted: Wednesday, April 2, 2014 1:12:24 PM
Rank: Advanced Member
Groups: Member

Joined: 4/2/2014
Posts: 37
Hi,

I am replacing System.Windows.Forms.WebBrowser with EO.WebBrowser.WinForm.WebControl. In my project, I need to first render a page. After navigation is completed, I need to programmatically modify the html content and then see the changes on the browser control immediately. For example, I need to change style or classname attributes on a tag. I tried something like this:

browserCtrl.WebView.GetDOMWindow().document.getElementById("id").className = "myclass"

But classname is read-only, so I can't do this.

Also, I have no idea how to change style attribute or outerHTML.

Any help will be greatly appreciate

Thanks
Howie

eo_support
Posted: Wednesday, April 2, 2014 1:18:53 PM
Rank: Administration
Groups: Administration

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

You can do something like this:

Code: C#
browserCtrl.WebView.EvalScript("document.getElementById('id').className='css_class_name';");


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.