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.

Link not working

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

Re: Link not working

Post by salvadordf »

Is this the error you see?
https://bugs.chromium.org/p/chromium/is ... l?id=76491

It seems to be an old Chromium issue.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Link not working

Post by salvadordf »

Now that I re-read your post, do you mean that you click on the links and the browser seems to do nothing?

Perhaps the browser is trying to start downloading that PDF.
Check the link attributes and the HTTP headers to see if the content type is correct.

Is your application configured in Windows as a *.PDF viewer ?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Link not working

Post by salvadordf »

I just checked the MiniBrowser demo in that page and when I click on the "Fuldmagt til summax" link it starts downloading a file called "talende Ø90 - Samtykke til Summax.pdf" in the "documents" folder.

The A element doesn't have a "type" attribute so I'm guessing that the HTTP server is instructing the browser to download the file. If you want to view the PDF you probably need to modify the HTTP headers served when the browser requests that PDF file.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Link not working

Post by salvadordf »

I thought you needed to show the PDF contents. If you just need to save the file then forget about the HTTP headers.

You need to use the TChromium.OnBeforeDownload and TChromium.OnDownloadUpdated events.

The documents for those events are here :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html
https://magpcss.org/ceforum/apidocs3/pr ... lback.html
https://magpcss.org/ceforum/apidocs3/pr ... lback.html

The MiniBrowser demo has most of the code you need but if you want to show a "Save as..." dialog then you need to call callback.cont with the "showDialog" parameter set to true inside the TChromium.OnBeforeDownload event.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Link not working

Post by salvadordf »

Yes. You can save the "callback" parameter and call callback.cont asynchronously after you show your custom "Save as..." dialog.

In fact, the JavaScript/JSDialogBrowser demo does something similar with the JavaScript dialogs.

Make sure you set the your copy of the "callback" parameter to NIL after you use it to avoid problems when you close your application.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Link not working

Post by salvadordf »

Oh, ok. I misunderstood.

Then you need to download the file and show an "open file" dialog when it's finished.

Both things are implemented in the MiniBrowser demo. You only need to copy the code in TMiniBrowserFrm.Chromium1BeforeDownload and TMiniBrowserFrm.Chromium1DownloadUpdated to download the file, and copy the code in TMiniBrowserFrm.Openfile1Click to open it.
Post Reply