Can you intercept hyperlink clicks with FireMonkey (cross platform)

  

I have a TWebBrowser on a FireMonkey app (Android and iOS).

I’d like to be able to intercept (trap) hyperlink clicks in the TWebBrowser and do something different with them.

I’ve found references to working with the BeforeNavigate2 event. However, I see no way of adding a procedure for that event in the Object Inspector. And I’m not sure if that event exists for Android or iOS; or if it’s just a Windows event.

Is there any way to get to intercept hyperlink clicks cross platform?

[Edit]

My ultimate goal here is to intercept a hyperlink click in the browser component and do something different with it (e.g., I’d like to spawn it off to the native browser instead).

OnShouldStartLoadWithRequest doesn’t trigger on a click. Actually it doesn’t seem to trigger anywhere for me. Others have had this issue (Incus J).

OnDidStartLoad does trigger; however, it appears to carry on with the page load in the background regardless of what’s going on in the trigger. I can add a myWebBrowser.Stop in the trigger; however, it does not reliably work. I suspect that sometimes the page load completes before the Stop gets fired off.

Playing with OnDidFinishLoad and using the GoBack method proved awkward because the previous page would reload to the top of the page instead of what was being shown in the control (if the user scrolled).

Am I stuck trying to Android/iOS equivalents of TWindowsWebBrowserService as Incus J suggests in the thread I reference above?

Comments are closed.