根据 TWebBrowser.OnBeforeNavigate2 中的参数 URL
Occurs immediately before the Web browser navigates to a new resource.
type TWebBrowserBeforeNavigate2 = procedure(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant; var Flags: OleVariant; var TargetFrameName: OleVariant; var PostData: OleVariant;
var Headers: OleVariant; var Cancel: WordBool) of object;
property OnBeforeNavigate2: TWebBrowserBeforeNavigate2;
Description
Write an OnBeforeNavigate2 event handler to redirect or cancel a change to a different URL. This event may occur as the result of a call to the Navigate or Navigate2 method, or the user clicking a link.
Sender is the Web browser control that is about to look up a new URL.
pDisp is the Automation interface of the Web browser control specified by Sender.
URL is the Uniform Resource Locator of the resource the Web browser is looking up. Change this value to redirect the navigation operation to a different resource.
Flags is not currently used.
TargetFrameName is the name of the frame in which the resource will be displayed, or NULL if the resource should not be displayed in a named frame. Change this value to change where the resource is displayed. See the Navigate method for a list of possible values.
PostData contains the data sent to the server when the underlying operation is an HTTP post message. The event handler can change this value before it is sent to the target URL.
Headers contains any headers sent to the servers when the URL represents an HTTP message. HTTP headers specify such things as the intended action required of the server, the type of data, and so on. (See TWebRequest object, whose properties represent many of the more common headers). The event handler can change this value before it is sent to the target URL.
Cancel determines whether the Web browser looks up the specified resource after the event handler exits. Change Cancel to True to cancel the navigation operation.