|
OnBeforeNavigate2: Write an OnBeforeNavigate2 event handler to redirect or cancel
or change navigation. This event fire as the result of a call to the
Navigate or Navigate2 method, or when the user clicking on a
link.
In simple words, here is the place to cancel navigation to a url or open new window.
This important event also uses to prevent Popup windows.
Its use is simple, just write Cancel:= True to prevent the navigation.
Command Arguments:
Sender
- The TEmbeddedWB component for which the event is being generated. Usage:
(Sender as TEmbeddedWB)
pDisp
- The IWebBrowser component for which the event is being generated. This is the top level browser if:
(pDisp as IWebBrowser) = (Sender as TEmbeddedWB).DefaultInterface
URL
- The URL that is to be navigated to.
Flags
- Not currently used.
TargetFrameName
- Name of the frame in which the URL is to be displayed (if named), otherwise nil.
PostData
- TBD
Headers
- TBD
Cancel
- Flag allowing the browse operation to be cancelled or blocked.
Set True to cancel the browse, False to allow it to go ahead. Has the
value False on entry.
procedure TfrmMain.EmbeddedWB1BeforeNavigate2(ASender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
begin
If CheckBox1.Checked then Cancel:= True
else Cancel := false;
end;
|