Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
How to get the click's URL?
How to get the click's URL?
Hi, how to get the URL when click the link before loading... thank you!
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to get the click's URL?
Hi,
Use the TWVBrowser.OnNavigationStarting event and create a TCoreWebView2NavigationStartingEventArgs instance like this :
Use the TWVBrowser.OnNavigationStarting event and create a TCoreWebView2NavigationStartingEventArgs instance like this :
Code: Select all
uses
uWVCoreWebView2Args;
...
procedure TMiniBrowserFrm.WVBrowser1NavigationStarting(Sender: TObject; const aWebView: ICoreWebView2; const aArgs: ICoreWebView2NavigationStartingEventArgs);
var
TempArgs: TCoreWebView2NavigationStartingEventArgs;
begin
TempArgs := TCoreWebView2NavigationStartingEventArgs.Create(aArgs);
if TempArgs.IsUserInitiated then
begin
// Use TempArgs.URI here. It has the link that the user clicked.
end;
TempArgs.Free;
end;
Re: How to get the click's URL?
Very good, thanks a lot.