...duplicate a TWebbrowser Document?

Author: Thomas Stutz

Category: Internet / LAN

                          
procedure WB_Duplicate(WB1, WB2: TWebbrowser);
var
  
URL: string;
begin
  
// get the URL of WB1
  
URL := WB1.LocationURL;
  // navigate to the URL with WB2
  
WB2.Navigate(URL);
  // wait until document loaded
  
while (WB2.ReadyState <> READYSTATE_COMPLETE) and not (Application.Terminated) do
  begin
    
Application.ProcessMessages;
    Sleep(0);
  end;
  // duplicate contents (i.e. user-entered text)
  
(WB2.Document as IHTMLDocument2).body.innerHTML :=
    (WB1.Document as IHTMLDocument2).body.innerHTML;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base