How to implement CefRequestHandler

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

How to implement CefRequestHandler

Postby navisrob » Sat Jun 27, 2015 3:57 pm

Hi! I need to implement some events related to browser requests. So in CefGlue.Client demo from solution I implemented interface:

Code: Select all
namespace Xilium.CefGlue.Client
{
    class WebRequestHandler : CefRequestHandler
    {

        protected override CefReturnValue OnBeforeResourceLoad(CefBrowser browser, CefFrame frame, CefRequest request, CefRequestCallback callback)
        {
            Console.WriteLine("Cancel all");
            return CefReturnValue.Cancel;// .Continue;
        }
}

I expect that it will write "Cancel all" to console and cancel loading all pages, but it is not. Do I need more actions? Is there some demo? (I Ctrl+F-ed "CefRequestHandler" through all solution and found it in CefGlue.demo, but there are no more instances of WebRequestHandler, what I missed?).
Before cefglue I used cefpython bindings, in which browser object contains browser.SetClientHandler method, what alternative is in CefGlue? Thanks.
navisrob
Techie
 
Posts: 14
Joined: Mon May 25, 2015 1:41 pm

Re: How to implement CefRequestHandler

Postby navisrob » Mon Jun 29, 2015 5:54 am

May be it is not good idea, but for now solved by modifing CefWebRequestHandler in CefGlue.WindowsForms project, and it works.
navisrob
Techie
 
Posts: 14
Joined: Mon May 25, 2015 1:41 pm


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 20 guests