Chromium1.LoadRequest(TempRequest) > When making a POST request
Redirects are connected automatically.
About 3 redirection URLs will appear. Select the specific URL you want.
You will see about 3 redirect URLs. Use the specific URL you want as Chromium1BeforeResourceLoad
if (Pos('https://www.briskbard.com/forum/', Request.Url) > 0) then
I would like to change the referer.
procedure TForm1.Chromium1BeforeResourceLoad(Sender: TObject;
const Browser: ICefBrowser; const Frame: ICefFrame; const Request: ICefRequest;
const Callback: ICefRequestCallback; out Result: TCefReturnValue);
var
TempOldMap, TempNewMap: ICefStringMultimap;
i: NativeUInt;
key, value: ustring;
begin
if (Pos('https://www.briskbard.com/forum/', Request.Url) > 0) then //This is an example.
begin
try
TempNewMap := TCefStringMultimapOwn.Create;
TempOldMap := TCefStringMultimapOwn.Create;
request.GetHeaderMap(TempOldMap);
i := 0;
while (i < TempOldMap.Size) do
begin
key := TempOldMap.Key;
value := TempOldMap.Value;
if key <> 'referer' then
begin
TempNewMap.Append(key, value);
end;
inc(i);
end;
TempNewMap.Append('referer', 'https://google.com');
request.SetHeaderMap(TempNewMap);
finally
TempNewMap := nil;
TempOldMap := nil;
end;
end;
This doesn't work.
You can try it yourself. Change is difficult.
I would like to change the specific URL referrer for the redirected part.
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.
I would like to change the referer. help.
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: I would like to change the referer. help.
Download CEF4Delphi from GitHub. I just added an example of HTTP header replacement in MiniBrowser :
https://github.com/salvadordf/CEF4Delphi/blob/bf11a7586e0035f9a36e5bf7cdfdc011a75193f5/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1227
https://github.com/salvadordf/CEF4Delphi/blob/bf11a7586e0035f9a36e5bf7cdfdc011a75193f5/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1227
Re: I would like to change the referer. help.
Referer It doesn't change.
The rest changes well.
Please do the Referer test just once.
The rest changes well.
Please do the Referer test just once.
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: I would like to change the referer. help.
Chromium seems to be blocking any change to that header.
Re: I would like to change the referer. help.
So are you saying that change is difficult?
Can the referer never be changed?
Can the referer never be changed?
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: I would like to change the referer. help.
If Chromium is blocking it then one solution would be to modify Chromium's source code and build CEF with those sources.
You could also try the Network.setExtraHTTPHeaders DevTools method but I've never used it :
https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setExtraHTTPHeaders
You could also try the Network.setExtraHTTPHeaders DevTools method but I've never used it :
https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setExtraHTTPHeaders