How or where do i put the stringlist?
Thanks
SFern.
Main Topics
Browse All TopicsHi there,
I would like to know how to have a list of URLs and possible keywords that TBrowser will check and if its on the list it will not browser the net, something around those line. Like a url filter.
Thanks
SFern.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You can indeed. In the code I posted above just substitude the ListBox.Items property where I called Filte, i.e:
procedure TMyForm.WBOnBeforeNavigate
Sender: TObject;
const pDisp: IDispatch;
var URL, Flags, TargetFrameName, PostData, Headers: OleVariant;
var Cancel: WordBool);
begin
// Search the filter and cancel as required
for i := 0 to Keywords.Count-1 do
if Pos(LowerCase(ListBox1.Ite
end;
In the code i posted in my first reply I also made a big mistake, it should be:
procedure TMyForm.WBOnBeforeNavigate
Sender: TObject;
const pDisp: IDispatch;
var URL, Flags, TargetFrameName, PostData, Headers: OleVariant;
var Cancel: WordBool);
var
Filter: TStringList;
begin
// Get the filter list, created and populated elsewhere
Filter := GetFilter;
// Search the filter and cancel as required
for i := 0 to Keywords.Count-1 do
if Pos(LowerCase(Filter.Strin
end;
Business Accounts
Answer for Membership
by: virtorioPosted on 2006-01-26 at 01:58:01ID: 15793703
If by TBrowser you mean TWebBrowser then this is quite simple. You'll want to write an event handler for the OnBeforeNavigate2 event. The event properties are as follows:
2(
2(
ings[i]), LowerCase(URL)) <> 0 then Cancel := true;
OnBeforeNavigate2(
Sender: TObject;
const pDisp: IDispatch;
var URL, Flags, TargetFrameName, PostData, Headers: OleVariant;
var Cancel: WordBool);
Simply examine at the URL item (which is a string). If you wish to stop the browser from navigating to that particular URL simply set Cancel to true, for example
procedure TMyForm.WBOnBeforeNavigate
Sender: TObject;
const pDisp: IDispatch;
var URL, Flags, TargetFrameName, PostData, Headers: OleVariant;
var Cancel: WordBool);
begin
// Block AOL's web site
if Pos('aol', URL) <> 0 then
Cancel := true;
end;
If you wish to have a list of URLs or keywords, simply create a list of them in a TStringList object and use a for loop to go though each item Canceling the operating as necessary.
procedure TMyForm.WBOnBeforeNavigate
Sender: TObject;
const pDisp: IDispatch;
var URL, Flags, TargetFrameName, PostData, Headers: OleVariant;
var Cancel: WordBool);
var
Filter: TStringList;
begin
// Get the filter list, created and populated elsewhere
Filter := GetFilter;
// Search the filter and cancel as required
for i := 0 to Keywords.Count-1 do
if Pos(LowerCase(Keywords.Str
end;
There are of course numerous ways of filtering out URLS and keywords, this is just a simple example.
Sorry if I made any mistakes in the above code. I can't test at the moment as I'm using a Mac. Hope that is of some use to you.