How to get current URL of website on the TWebBrowserControl

Hi Bruno,

Just a quick question here, Do you know how to get current URL for the page of website sitting on WebBrowser control?



  el: TJSElement;
  url: string;
  el := webbrowsercontrol1.ElementHandle;
    url = el.contentWindow.location;

Thanks Bruno for reply.

I tried in a test project and it throwed error:

Uncaught DOMException: Blocked a frame with origin "http://localhost:8000" from accessing a cross-origin frame.

Is there is way to overcome this?

Thanks for the help,

I suspect that what you show in the TWebBrowserControl is in a different domain?
If so, it is a security policy that from an external source, this URL cannot be returned.

Yes, for now we are using different domain for testing purpose. But in the coming future, we will merge it into our domain. Anyway, thanks so much for the verification. That helps a lot!