Replace WebBrowser with Tchromium
Used to EMBEDDEDWB, do not want to change, but IE kernel has been a memory leak problem, there is no way, only look for alternatives.
To change the habit of EMBEDDEDWB to a completely different tchromium, a bit of a challenge, especially in the information is not much, English has not been three levels of the case. The future trend is like this, only slowly gnawing.
First, think of the cross-domain, if not cross-domain, there is no way to replace the hand of the finished product. Tchromium's cross-domain is simpler than imagined, directly through CHRM. Browser.getframenames (list);//list:tstringlist; Gets the name of each iframe/frame (the so-called name does not refer to the ' name ' attribute, but an identity, when there is a name, returns the name, without name , the ID is also OK, when there is no, automatically generate a unique name), such as:
FF//This is the ID of a frame
<!--framepath//ff/<!--frame0-->-->
<!--framepath//ff/<!--frame1-->-->
<!--framepath//ff/<!--frame2-->-->//Back three is a unique name that is automatically generated
Gets the specified frame, via Chrm1. browser.frame[' Frame name '], get Icefframe interface, follow the operation please feel free.
followed by the form, the use of Google Browser is aware that its filling function is really powerful, in the WebBrowser era, is generally to get forms elements of various interfaces, and then set its value, checked and other properties, and in Tchromium, everything is JS, What you want to do is let JS to execute it, so, with tchromium,js skill deep will be a lot easier. Like what:
strtemp: = ' document.forms[0].inmembername.value= ' user_name "; Javaexec (strtemp); strtemp: = ' document.forms[0].inpassword.value= ' Password "; Javaexec (strtemp); strtemp: = ' Document.forms[0].submit.click (); chrm.browser.frame[' FF '). Executejavascript (str, ' About:blank ', 0);; Which layer you want to execute on, which layer to call
Even more amazing is that you can also load your own jquery into the browser by the following methods:
Procedure Tform3.chrm1loadend (Sender:tcustomchromium; Const Browser:icefbrowser; Const Frame:icefframe; Httpstatuscode:integer; Out result:tcefretval); var str:string;begin str:= ' var ohead = document.getelementsbytagname (' HEAD '). Item (0); ' #13 #10+ ' var oscript = document.createelement ("script"); ' #13 #10+ ' oscript.language = "javascript"; ' #13 #10+ ' oscript.type = "text/javascript"; ' #13 #10+ ' oscript.id = "Sid"; ' #13 #10+ ' oscript.defer = true; ' #13 #10+ 'oscript.src = "Jquery.js";' #13 #10+ ' Ohead.appendchild (oscript); ' #13 #10+ ' alert ("8") '; Frame.executejavascript (str, ' About:blank ', 0); end;
Direct connection to local js!!! This code is finally written in Loadend, each load completes a frame, let the frame load its own jquery, if you need to use the time to load the jquery,jquery load will take time, may lead to the next JS code will not take effect.
Finally, the last to come here, the next time to say about the pop-up window, right-click menu, touch the mouse and other content.
Attached: Google Forum, Delphi tchromium Issues Discussion Group: http://groups.google.com/group/delphichromiumembedded
Replace WebBrowser with Tchromium