I am currently working on an Internet Explorer, on which an HTML-document should be scanned for URL in plain text . , And then "link" them.
I have use DOM for websites, and to search for "links" to cross all those DOM nodes and use the REENEX, HTML- however, when IHTMLElement object's "intersect" When the property changes, all of its children node are lost, which websites seriously do f * cks.
Here are some code:
// This method is called when IE loaded a page zero _webBrowser2Events_DocumentComplete (Object PDs, Ref Object URL) is. {If (pDisp == _webBrowser2) {HTMLDocument pageContent = _webBrowser2.Document; IHTMLElement bodyHtmlElmnt = pageContent.body; FixElement (bodyHtmlElmnt); }}
And here is the fix element:
Zero lower fixation (IHTmamentation node) {if (node.innerText! = Null & amp; (IHTMLElementCollection) node. Child) Length == 0) {node. Winner Lesson = Node. Winner Lesson Change ("Teststring", "Replace with"); } Forresh (IHTmlement Child In (as an NMMMTML, IHTmlement Control)) {Fix Element (Hair); }}
This works, but for nodes only who has no child.
Can anyone help me with this problem, I would be very grateful!
Regards
// Heinrich
Why not If you want to use javscript like this simply execute this javascript using your c # code. Just
webBrowser1.Navigate (new urie ("javascript: "));
The good thing about this is that you can do many things without searching again, URL linking JavaScript is too old by people, so just use that code.
If there is a script (this is a large, you can insert it from * .js file using this script)
javascript: (function () { Document.body.appendChild (Create Document Element ('script')). Src = '& lt; your script URL';;}) ();
Replace with your Javascript hosted locally or locally (if local use file: // url format)
Comments
Post a Comment