Force CEFSharp to download without showing dialog

Tour Looking picture Tour Looking · Feb 17, 2015 · Viewed 7.9k times · Source

I have a WPF application with CEFSharp, it's a web browser, when I click on a download link it will show me a dialog and ask me where you want to save the file?
How can I force the web browser to download any files without showing dialog? I want to create some thing like google chrome. so when you click on a download link it will download the file to a default path (usually it's in "Documents/Downloads")

now how can I implement this in my application?
if I need to change CEFSharp source code please tell more details because I found some solution but there aren't a complete example, there was just a part of code! thank you.

Answer

jornh picture jornh · Feb 17, 2015

There is an example in the main CefSharp GitHub repository

This search points to the relevant code bits: https://github.com/cefsharp/CefSharp/search?q=DownloadHandler&type=Code&utf8=%E2%9C%93

You see the common example handler in the CefSharp.Example project gets instantiated from both the CefSharp.Example.WinForms and CefSharp.Example.Wpf projects. It's not that long since I tried playing around with the WinForms one, I'm less sure about the WPF one but with a quick glance it looks functional. If not it's a bug that needs fixing!

If you perform a search for IDownloadHandler you should see the documentation of the interface. It sounds like in your case you want to set the showDialog parameter to false.