VitalElement / CefGlue.Core

Port of CefGlue to .net Core
88 stars 23 forks source link

Callback event for loading url #23

Closed da3dsoul closed 3 years ago

da3dsoul commented 3 years ago

There seems to be an event for starting and finished loading, but it doesn't even give the URL. Is there some way to extract the URL from the Avalonia (I assume it's the same across them) webview control?

da3dsoul commented 3 years ago

I figured that out. Frame.Url wasn't populating my intellisense, but I could find it through debug inspection.

Programmatically navigating to a URL is where I'm at.

Dispatcher.UIThread.InvokeAsync(() =>
{
    var webview = this.FindControl<AvaloniaCefBrowser>("WebView");
    webview.StartUrl = uri;
});

It doesn't work for some reason. My first guess is that it's not an observable property by default.

da3dsoul commented 3 years ago

There should be a helper method for this. I found it in the code for the WPF one. For future people:

var webview = this.FindControl<AvaloniaCefBrowser>("WebView");
webview.Browser.GetMainFrame().LoadUrl(url);