There is the most common form in which one button and webbrowser, when you click on the button, we get into Google. // event by clicking the button webbrowser1.Navigate ' https://google.com/ '; // the browser is waiting for full download
after which I enter the site I need in the browser and navigate through it // here I assigned the onBeforce2 event ... during which the webbrowser2 and PageTab2 is created and opens the site there. I look at webmaster statistics - Direct entry. What am I doing wrong?
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleCtrls, SHDocVw, Vcl.ComCtrls; type TForm1 = class(TForm) PageControl1: TPageControl; TabSheet1: TTabSheet; TabSheet2: TTabSheet; WebBrowser1: TWebBrowser; WebBrowser2: TWebBrowser; Button1: TButton; procedure Button1Click(Sender: TObject); procedure WebBrowser1NewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin webbrowser1.navigate('https://www.google.ru/'); end; procedure TForm1.WebBrowser1NewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool); begin ppDisp := Webbrowser2.DefaultDispatch; end; end.