Page 1 of 1

GlobalCEFApp.DisablePDFExtension problem

Posted: Wed Jul 10, 2019 3:00 pm
by coater
if set
GlobalCEFApp.DisablePDFExtension:=true;

vist web PDF such as:
https://www.irs.gov/pub/irs-pdf/i2290.pdf

Chromium1BeforeDownload will not be triggered and PDF file will be download directly.

is this a bug?

Re: GlobalCEFApp.DisablePDFExtension problem

Posted: Wed Jul 10, 2019 4:54 pm
by salvadordf
I just tested setting GlobalCEFApp.DisablePDFExtension to true and navigating to this URL and TChromium.OnBeforeDownload is executed as expected.
https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf

Please, provide all the code necessary to reproduce that issue.

Re: GlobalCEFApp.DisablePDFExtension problem

Posted: Thu Jul 11, 2019 1:26 pm
by coater
I am really very sorry for my mistake. :cry:
I used Chromium1.StopLoad. (But I have download the file befor)

Thank you very much!
procedure TIinformSearchFrm.Chromium1ResourceResponse(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; const response: ICefResponse;
out Result: Boolean);
{var TempHeaderMap : ICefStringMultimap;
i:integer; }
begin
{ TempHeaderMap:= TCefStringMultimapOwn.Create;
(response.GetHeaderMap(TempHeaderMap) ) ;
memo1.Lines.Add( request.Url+':' );
for i:=0 to TempHeaderMap.Size -1 do
begin
memo1.Lines.Add(TempHeaderMap.Key+': ' + TempHeaderMap.Value);
end; }
//memo1.Lines.Add( browser.MainFrame.Url ) ;
//memo1.Lines.Add(request.Url ) ;
//memo1.Lines.Add(response.URL ) ;
// memo1.Lines.Add('browser.Identifier:'+ inttostr(browser.Identifier) +'Chromium1.BrowserId_ : ' + inttostr(Chromium1.BrowserId) ) ;
if ((ansipos('application/pdf', response.GetHeader('Content-Type') )>0) or ( ansipos('application/pdf', response.GetHeader('content-type') )>0) )
then // and (DownPdfUrl <> request.Url)
begin
//DownPdfUrl:=request.Url ;
if not IfOnDown then
begin
Chromium1.StopLoad;
end;
end;