salvadordf / WebView4Delphi

WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
https://www.briskbard.com/forum/
MIT License
280 stars 56 forks source link

Download files such as xls, PDF, CSV, etc #42

Closed wakswaks closed 1 year ago

wakswaks commented 1 year ago

Dear salvadordf,Sorry to bother you again, but it seems that I cannot receive activation emails after registering in forum 'briskbard.com'.

When I click on a webpage button, it triggers the submit event,then a .csv file will be directly opened in the pop-up ChildForm. However, I hope to implement downloading the file instead of directly opening it in the browser. How can I modify the code to achieve the desired result? Thank you!!!

salvadordf commented 1 year ago

I just activated the user KsWang manually at briskbard.com.

Sorry for the inconvenience.

This is the WebView2 issue about the pop-up windows with office documents.

If your application uses the evergreen standalone Webview2 runtime then the pp-up windows should be disabled by default according to the information in the previous link.

If you still have this issue try adding this code line before the GlobalWebView2Loader.StartWebView2 call : GlobalWebView2Loader.DisableFeatures := 'msOpenOfficeDocumentsInWebViewer';

wakswaks commented 1 year ago

I tested and found that when using my own server to return a. csv file,It was downloaded normally instead of being opened directly by the browser.

When the. csv file returned by someone else's server , It is opened by the browser instead of being downloaded.

I suspect it may be caused by the server responding with an empty or unsuitable Content-Type.

salvadordf commented 1 year ago

It looks more and more that this issue is outside of the scope of the WebView4Delphi project.

Closing...