Search code examples
c#chromiumcefsharp

Cefsharp how to get current URL address? c#


I want to get the current address and basically put it in a textbox. I found this link but can't seem to understand anything.

http://cefsharp.github.io/api/57.0.0/html/P_CefSharp_WinForms_ChromiumWebBrowser_Address.htm

I would really appreciate a code snippet from someone. It's killing me. i'm using WFA.


Solution

  • You have to listen to below address change event and persists it yourself.

    this.Browser = new ChromiumWebBrowser();
    this.Browser.AddressChanged += Browser_AddressChanged;
    
    private void Browser_AddressChanged(object sender, AddressChangedEventArgs e)
            {
                this.CurrentAddress = e.Address;
            }