andreykrasnodar wrote: ↑Wed Jul 01, 2020 8:54 pm
andreykrasnodar wrote: ↑Wed Jul 01, 2020 11:45 am
Code: Select all
procedure TForm1.Chromium1BeforePopup(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
userGesture: Boolean; var popupFeatures: TCefPopupFeatures;
var windowInfo: TCefWindowInfo; var client: ICefClient;
var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean;
out Result: Boolean);
var
Header: ICefStringMultimap;
Request: ICefRequest;
Data: ICefPostData;
begin
Result:=True;
Header := TCefStringMultimapOwn.Create;
Header.Append('Referer', Chromium1.Browser.MainFrame.Url);
Request := TCefRequestRef.New;
Request.Assign(targetUrl, 'GET', Data, Header);
Chromium1.Browser.MainFrame.LoadRequest(Request);
end;
This code works great, but sometimes application crashes with message
APPCRASH
5efcf65f
libcef.dll
3.2454.1344.0
562d8f27
80000003
00186429
6.3.9600.2.0.0.256.48
1049
1: 5861
2: 5861822e1919d7c014bbb064c64908b2
3: d1d9
4: d1d94a13d3609d6b740644c12508f581
This example will work only in simple cases when the link from site A leads directly to site B. And, for example, this will not work with the yandex search engine, since in Chromium1.Browser.MainFrame.Url there will be an httpS search link, and in targetUrl there will be a direct link to the site from the search result. As a result, we get an empty referrer at the transition.
I am currently watching an example of PopupBrowser2, but I just can’t figure out how to redirect the transition to the current window without opening a new one. Help please, can this be done?