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'];
?>