Hello,
What would be the best event for replacing TWebBrowser.OnBeforeNavigate2, i need to examine the URL, perform certain actions and cancel the processing when they click on a link.
Thanks,
Eugene.
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.
OnBeforeNavigate2 replacement
Re: OnBeforeNavigate2 replacement
Event OnBeforeBrowse, example
Code: Select all
if request.Url='https://www.google.com/' then
Result := true;
Re: OnBeforeNavigate2 replacement
Thank you.
Re: OnBeforeNavigate2 replacement
1. Are there other events to use in the same scenario, because this one does not work well with my existing code.
2. Where can i read the documentation on this event?
2. Where can i read the documentation on this event?
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: OnBeforeNavigate2 replacement
TChromium.OnBeforeResourceLoad is similar but TChromium.OnBeforeBrowse is the closest event to TWebBrowser.OnBeforeNavigate2egold2005 wrote: Fri Sep 04, 2020 9:24 am 1. Are there other events to use in the same scenario, because this one does not work well with my existing code.
There are several ways to do that. Open the TChromiumCore source code in uCEFChromiumCore.pas and take a look at the events. You will see that they are grouped and each group has a comment with the name of an interface. For example, TChromiumCore.OnBeforeBrowse has ICefRequestHandler and TChromiumCore.OnBeforeResourceLoad has ICefResourceRequestHandler.
Open this page and scroll down a few paragraphs :
https://www.briskbard.com/index.php?lan ... =cef#usage
You will see a bunch of blue links with the name of the CEF classes bellow the text "As you can see in the source code, TChromium has the functions, procedures and events of"
Those classes have the same name as the previous interfaces but without the initial "I".
Click on the "CefRequestHandler" link to see the documentation for TChromiumCore.OnBeforeBrowse :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html
And click on the "CefResourceRequestHandler" link for more information about TChromiumCore.OnBeforeResourceLoad :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html
All the CEF documentation is here :
https://magpcss.org/ceforum/apidocs3/
It's a copy of the CEF code comments but the previous link is easier to navigate.