GlobalCEFApp.DisablePDFExtension problem

Post Reply
coater
Posts: 52
Joined: Sat Sep 29, 2018 1:51 pm

GlobalCEFApp.DisablePDFExtension problem

Post by coater » Wed Jul 10, 2019 3:00 pm

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?

User avatar
salvadordf
Posts: 1950
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: GlobalCEFApp.DisablePDFExtension problem

Post by salvadordf » Wed Jul 10, 2019 4:54 pm

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.

coater
Posts: 52
Joined: Sat Sep 29, 2018 1:51 pm

Re: GlobalCEFApp.DisablePDFExtension problem

Post by coater » Thu Jul 11, 2019 1:26 pm

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;

Post Reply