Solved

Using two TWebBrowsers ?

Posted on 2008-10-03
2
153 Views
Last Modified: 2010-04-21
I currently build some HTML text and then laod it into a TWebBrowser. The user can click on a link and it will go to another page (in the current TWebBrowser1).

Is it possible to build a link to tell it that when the user clicks the link, the page will load into a second TWebBrowser (TWebBrowser2)?

If so, How?

Thanks
0
Comment
Question by:geocoins-software
2 Comments
 
LVL 21

Accepted Solution

by:
ziolko earned 250 total points
ID: 22635985
yup, this sould do the trick:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleCtrls, SHDocVw;

type
  TForm1 = class(TForm)
    WebBrowser1: TWebBrowser;
    WebBrowser2: TWebBrowser;
    Button1: TButton;
    procedure WebBrowser1BeforeNavigate2(Sender: TObject;
      const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
      Headers: OleVariant; var Cancel: WordBool);
    procedure Button1Click(Sender: TObject);
  private
    FRedirect: Boolean;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
  const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
  Headers: OleVariant; var Cancel: WordBool);
begin
  if FRedirect then begin
    WebBrowser2.Navigate(URL);
    Cancel := True;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  FRedirect := False;
  WebBrowser1.Navigate('www.experts-exchange.com');
  FRedirect := True;
end;

end.

ziolko.
0
 

Author Closing Comment

by:geocoins-software
ID: 31502841
That will do it. It works great!  Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question