Page 1 of 2
Setting and sending header
Posted: Thu Aug 06, 2020 1:25 pm
by andreykrasnodar
Unfortunatelly the code below
Code: Select all
procedure TForm1.Test;
var
Header: ICefStringMultimap;
Request: ICefRequest;
Data: ICefPostData;
begin
Header := TCefStringMultimapOwn.Create;
Request := TCefRequestRef.New;
Header.Append('Referer', 'https://some-site.com');
Request.Assign('https://mysite.com', '', nil, Header);
Chromium2.Browser.MainFrame.LoadRequest(Request);
end
Opens website but does not send referrer.
Re: Setting and sending header
Posted: Fri Aug 07, 2020 8:22 am
by dilfich
Try this
Code: Select all
Request := TCefRequestRef.New;
Request.Assign(url, '', nil, Header);
Request.SetReferrer(url, REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE);
WB.Browser.MainFrame.LoadRequest(Request);
Re: Setting and sending header
Posted: Fri Aug 07, 2020 10:21 am
by andreykrasnodar
REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE
does not exist in old CEF versions
Re: Setting and sending header
Posted: Sun Aug 23, 2020 9:02 pm
by andreykrasnodar
dilfich wrote: Fri Aug 07, 2020 8:22 am
Try this
Code: Select all
Request := TCefRequestRef.New;
Request.Assign(url, '', nil, Header);
Request.SetReferrer(url, REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE);
WB.Browser.MainFrame.LoadRequest(Request);
Undeclared identifier: 'TCefRequestRef'
Re: Setting and sending header
Posted: Mon Aug 24, 2020 10:21 am
by dilfich
So update))
And so only like-minded people to look for, who specifically the old version will not put exactly, and from memory or in theory it is unlikely to suggest something.
See the source code, there's probably just a different name.
Re: Setting and sending header
Posted: Mon Aug 24, 2020 10:33 am
by salvadordf
andreykrasnodar wrote: Sun Aug 23, 2020 9:02 pm
dilfich wrote: Fri Aug 07, 2020 8:22 am
Try this
Code: Select all
Request := TCefRequestRef.New;
Request.Assign(url, '', nil, Header);
Request.SetReferrer(url, REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE);
WB.Browser.MainFrame.LoadRequest(Request);
Undeclared identifier: 'TCefRequestRef'
Press CONTROL + SHIFT + F to search, select the "
Search in directories" option, select the OldCEF4Delphi\source directory in the "
Directories:" box, type "TCefRequestRef" in the "
Text to" box at the top and click the "
Ok" button.
You will see that TCefRequestRef is defined in uCEFRequest.pas
OldCEF4Delphi has all the classes that you had with dcef3 but they are in smaller files inside the "
sources" directory.
Re: Setting and sending header
Posted: Mon Aug 24, 2020 11:36 am
by dilfich
you need to find
SetReferrer and see what you need there.
Or Google, it's obviously faster)
For example, but I have no idea what your version is and what the procedures and functions.
https://stackoverflow.com/questions/129 ... h-chromium
Re: Setting and sending header
Posted: Mon Aug 24, 2020 4:30 pm
by andreykrasnodar
dilfich wrote: Mon Aug 24, 2020 10:21 am
So update))
And so only like-minded people to look for, who specifically the old version will not put exactly, and from memory or in theory it is unlikely to suggest something.
See the source code, there's probably just a different name.
I have updated to old CEF4Delphi and re-wrote my application.
Still does not send referer.
Re: Setting and sending header
Posted: Mon Aug 24, 2020 4:31 pm
by andreykrasnodar
salvadordf wrote: Mon Aug 24, 2020 10:33 am
You will see that TCefRequestRef is defined in uCEFRequest.pas
Thanks. I have found and added it to 'uses'
Re: Setting and sending header
Posted: Mon Aug 24, 2020 4:46 pm
by andreykrasnodar
Yes, I have tried this few days ago and found out that if Request.Method='POST', referer will work and when Request.Method is GET, application can not send referer.
P.S. My version is 2623