Set the Referrer in JCEF

Having problems with building or using the JCEF Java binding? Ask your questions here.

Set the Referrer in JCEF

Postby wrightpt » Sat Dec 17, 2016 3:12 pm

The referrer can be set in C++ CEF with the following code:

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

CefRequest::ReferrerPolicy origin = REFERRER_POLICY_ALWAYS;
request->SetReferrer("https://www.google.com/",origin);


    return RV_CONTINUE;

}


Is there anyway to do this in JCEF? I am not seeing a method under CEFRequest to do this. I am going to try SetHeaderMap. I thought I read in one forum post that that only adds to the information instead of changes it.


Anyone have an example of doing this that contains the following information.

What HTTP Headers is my browser sending?


ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

ACCEPT_ENCODING gzip, deflate, br

ACCEPT_LANGUAGE en-US,en;q=0.5

CONNECTION keep-alive

HOST http://www.whatismybrowser.com

REFERER https://www.google.com/

UPGRADE_INSECURE_REQUESTS 1
USER_AGENT Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 15 guests