setting referrer compiles but no behavior change

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

setting referrer compiles but no behavior change

Postby wrightpt » Sat Jul 09, 2016 10:02 am

The virtual OnBeforeResourceLoad method is here (2nd method down): apidocs/projects/%28default%29/cef_request_handler.h.html

In my simple_handler.h located in my binary folder/ cefsimple/, I added the following text:

virtual CefRefPtr<CefRequestHandler> GetRequestHandler() override {
return this;
} //thank alexeibs from stackoverflow for this





virtual CefRequestHandler::ReturnValue OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefRequestCallback> callback) OVERRIDE ;

in my Simple_handler.cc located in my project folder, I have the following:

CefRequestHandler::ReturnValue SimpleHandler::OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefRequestCallback> callback)

{


std::string str1 = "http://magpcss.org/ceforum/apidocs3/projects/%28default%29/CefFrame.html#LoadString%28constCefString&,constCefString&%29";

CefRequest::ReferrerPolicy origin = REFERRER_POLICY_ALWAYS;

request->SetReferrer(str1,origin);


return RV_CONTINUE;

}

I have tried changing the Referrer policy to each available option but that did not help.
Everything compiles, but the Referer is not set, any ideas why?

happy to paste entire files if necessary.

I looked at the OnLoadError code in the SimpleHandler class. It is being implemented in the same way my function is, but it seems the setreffer method is not being called. IN the comments of OnBeforeResourceLoad, It states that the request object is able to be modified.

Any input on where I am not setting the referrer properly is appreciated
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 104 guests