If you just want to configure Chromium to avoid sending the referrer then set TChromiumCore.SendReferrer to False.
If you want replace the referrer header with a custom value then use the method described in the following link :
https://www.briskbard.com/forum/viewtopic.php?p=9766#p9766
If that doesn't work then Chromium is blocking any change of that header.
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Accept-Language I can't change it.
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Accept-Language I can't change it.
ICefRequest POST > Chromium1.LoadRequest(TempRequest); >
Chromium1BeforeResourceLoad What if I want to change the Referrer of just one specific URL?
TempHeaderMap.Append('Referer', 'https://google.com');
It is not added.
Chromium1BeforeResourceLoad What if I want to change the Referrer of just one specific URL?
TempHeaderMap.Append('Referer', 'https://google.com');
It is not added.
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Accept-Language I can't change it.
If Chromium allows modifying that header, it should be added in the TChromiumCore.OnBeforeResourceLoad event.
Identify the request by the URL using "request.Url" and follow the steps we discussed earlier :
https://www.briskbard.com/forum/viewtopic.php?p=9766#p9766
Create a TCefStringMultimapOwn instance, copy all headers except the "referer" and add you custom referer header. Then call request.SetHeaderMap with the new TCefStringMultimapOwn :
https://github.com/salvadordf/CEF4Delphi/blob/5ae265e9d3ce7076bda56c6429a642d5c76b83ef/demos/Delphi_VCL/OAuth2Tester/uOAuth2TesterFrm.pas#L359
Identify the request by the URL using "request.Url" and follow the steps we discussed earlier :
https://www.briskbard.com/forum/viewtopic.php?p=9766#p9766
Create a TCefStringMultimapOwn instance, copy all headers except the "referer" and add you custom referer header. Then call request.SetHeaderMap with the new TCefStringMultimapOwn :
https://github.com/salvadordf/CEF4Delphi/blob/5ae265e9d3ce7076bda56c6429a642d5c76b83ef/demos/Delphi_VCL/OAuth2Tester/uOAuth2TesterFrm.pas#L359
Re: Accept-Language I can't change it.
When opening the site once, you can specify the referrer like this
https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-navigate
Code: Select all
var
TempParams: ICefDictionaryValue;
begin
try
TempParams := TCefDictionaryValueRef.New;
TempParams.SetString('url', 'https://www.briskbard.com/forum/posting.php?mode=reply&t=2289');
TempParams.SetString('referrer', 'https://www.google.com/search');
FChromium.ExecuteDevToolsMethod(0, 'Page.navigate', TempParams);
finally
TempParams:= nil;
end;
end;
Re: Accept-Language I can't change it.
That's not the way.
I would like to change the referrer to a specific URL that is redirected to LoadRequest.
I would like to change the referrer to a specific URL that is redirected to LoadRequest.
Re: Accept-Language I can't change it.
If I understood correctly, then as an option..sodlf159 wrote: Mon Jun 03, 2024 10:10 am I would like to change the referrer to a specific URL that is redirected to LoadRequest.
We block the redirect in BeforeResourceLoad, and then open the redirect link again with the desired redirect.
When the link in Before ResourceLoad is blocked, the resource\site will not determine this.
But you probably need to wait for the site to fully load, if it's through a proxy. if not, then how did you catch the link to make CloseAllConnections and make a new download of a new link\redirect with the necessary referrer, cookies and so on will remain the same.