Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

GlobalCEFApp.DisablePDFExtension problem

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

GlobalCEFApp.DisablePDFExtension problem

Post 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?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: GlobalCEFApp.DisablePDFExtension problem

Post 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/t ... /dummy.pdf

Please, provide all the code necessary to reproduce that issue.
coater
Posts: 135
Joined: Sat Sep 29, 2018 1:51 pm

Re: GlobalCEFApp.DisablePDFExtension problem

Post 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;
Post Reply