Can not send referer
Posted: Tue Aug 18, 2020 10:45 am
I am using OLD version of CEF to run my program even on elder computers with Windows XP SP3
Trying to open new tab when user clicks on the link with target=blank.
The code with errirs is
I also tried this
But there are 2 problems:
the little one is: sometimes application hangs
and the main problem is the Chromium does not send GET request. Some sites have security settings that not allow them to load them when request is not 'GET'.
When I use just
It sends GET request and when I use
it does not.
To check it there is a simple code on PHP
Trying to open new tab when user clicks on the link with target=blank.
The code with errirs is
Code: Select all
var
Header: ICefStringMultimap;
Request: ICefRequest;
Data: ICefPostData;
i: Integer;
MainFrame : ICefFrame;
begin
Request := TCefRequestRef.New;
Request.Url := 'https://google.com';
Request.Flags := [UR_FLAG_ALLOW_CACHED_CREDENTIALS];
Request.Method := 'GET'; //or Request.setmethod('GET');
Header := TCefStringMultimapOwn.Create;
Header.Append('Referer', 'https://yandex.ru');
Header.Append('Origin', 'https://yandex.ru');
Request.SetHeaderMap(Header);
Data := TCefPostDataRef.New;
Request.SetPostData(Data);
try
MainFrame := Form1.Chromium2.Browser.GetMainFrame;
MainFrame.LoadRequest(Request);
except
showmessage('Fail');
end;
end;
Code: Select all
request.Assign('https://google.com','GET',Data,Header);
the little one is: sometimes application hangs
and the main problem is the Chromium does not send GET request. Some sites have security settings that not allow them to load them when request is not 'GET'.
When I use just
Code: Select all
.loadURL('https://example.com');
Code: Select all
.LoadRequest(Request);
To check it there is a simple code on PHP
Code: Select all
<?php
echo $_SERVER['REQUEST_METHOD'];
?>