MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
424 stars 51 forks source link

Intercept PDF "save" button and Downloads before Save dialog shows #2038

Open simon1689 opened 2 years ago

simon1689 commented 2 years ago

We are looking at the possibility of using WebView2 in our software. We use CefSharp at the moment, but we're not always satisfied with it. At the same time, it is important for us to have the same features in CefSharp as well as WebView. CefSharp and WebView will be two engines to view a URL with.

One of the things we do is set a download location for a URL (a WebLink object which has the URL, the download location, the browser engine, among other things). With CefSharp, at the time of clicking on the save button in the PDF viewer, we ask the user if they want to download the file through the regular browser way of doing this, or should we import it for them at the chosen location in the WebLink. I have not found a way to implement this with WebView. At the moment the save button is clicked in the PDF viewer, the regular "Save" dialog is shown. What I want is to ask the user how they would like to download this PDF and then choose to go the regular browser route or import it for them (without showing the save dialog).

Are there any ways to achieve this for WebView2?

AB#37625073

champnic commented 2 years ago

Hey @simon1689 - we don't currently have this behavior yet. We have a DownloadStarting event you can look at, but it doesn't suppress the "Save" dialog. I can add this as a feature request if you'd like (I thought we already had this on our backlog but I couldn't find it...).

simon1689 commented 2 years ago

Hey @simon1689 - we don't currently have this behavior yet. We have a DownloadStarting event you can look at, but it doesn't suppress the "Save" dialog. I can add this as a feature request if you'd like (I thought we already had this on our backlog but I couldn't find it...).

That would be awesome!