Solved

Using two TWebBrowsers ?

Posted on 2008-10-03
2
150 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now