Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cefsharp location change event C#

Tags:

c#

cefsharp

i need to know how can set event when location of web view changed on cefsharp and how can prevent not redirect to other url

        BrowserSettings browserSettings = new BrowserSettings();
        browserSettings.FileAccessFromFileUrlsAllowed = true;
        browserSettings.UniversalAccessFromFileUrlsAllowed = true;
        browserSettings.TextAreaResizeDisabled = true;
        WebView web_view;
        web_view = new WebView("http://google.com", browserSettings);
        web_view.LocationChanged += ??`enter code here`
        web_view.Dock = DockStyle.Fill;
        this.Controls.Add(web_view);
like image 606
armanso Avatar asked Aug 31 '26 11:08

armanso


1 Answers

I think you need to provide an implementation of the IRequestHandler interface. See https://github.com/cefsharp/CefSharp/blob/CefSharp1/CefSharp.Example/ExamplePresenter.cs#L263 If you return true you will block navigation.

The LocationChanged event you are talking about is not related to CefSharp web navigation. If you google for "LocationChanged event" it will probably leave a smile on your face :)

like image 90
jornh Avatar answered Sep 02 '26 09:09

jornh