In FMX how to get the current URL of a TWebBrowser control?


I use Delphi 10.3 Community edition. My FireMonkey Android/iOS application has a tab with TWebBrowser control, so users can load and browse the sites from the bookmarked list. When a user clicks on any link (for example, a category, a new product item or a new site) in the already loaded site, the new link is also loaded into the TWebBrowser. How to programmatically determine this new link that the user have just clicked on? Or how to programmatically determine the link of the currently loaded document in the TWebBrowser? That is easy to do for Windows applications, but for mobile applications the TWebBrowser component has very limited functionality. For example:

I load first url to TWebBrowser:

WebBrowser1.URL := ‘’
I browse this site and click on a new link to see category1 page in the same TWebBrowser.
After that I try to get current WebBrowser1 document url like this:

Label1.Caption := WebBrowser1.URL

but Label1.Caption is equal, although it should be

To define a new URL, I used different events like OnDidFinishLoad (starts many times), OnDidStartLoad (starts many times), OnShouldStartLoadWithRequest (never started) end even TButton.Onclick after new link is loaded. But I still couldn’t programmatically get the link

Comments are closed.