@@ -585,6 +585,8 @@ pub struct WebViewAttributes<'a> {
585
585
/// second is a mutable `PathBuf` reference that (possibly) represents where the file will be downloaded to. The latter
586
586
/// parameter can be used to set the download location by assigning a new path to it, the assigned path _must_ be
587
587
/// absolute. The closure returns a `bool` to allow or deny the download.
588
+ ///
589
+ /// [`Self::default()`] sets a handler allowing all downloads to match browser behavior.
588
590
pub download_started_handler : Option < Box < dyn FnMut ( String , & mut PathBuf ) -> bool + ' static > > ,
589
591
590
592
/// A download completion handler to manage downloads that have finished.
@@ -718,7 +720,7 @@ impl Default for WebViewAttributes<'_> {
718
720
ipc_handler : None ,
719
721
drag_drop_handler : None ,
720
722
navigation_handler : None ,
721
- download_started_handler : None ,
723
+ download_started_handler : Some ( Box :: new ( |_ , _| true ) ) ,
722
724
download_completed_handler : None ,
723
725
new_window_req_handler : None ,
724
726
clipboard : false ,
@@ -1159,6 +1161,8 @@ impl<'a> WebViewBuilder<'a> {
1159
1161
/// second is a mutable `PathBuf` reference that (possibly) represents where the file will be downloaded to. The latter
1160
1162
/// parameter can be used to set the download location by assigning a new path to it, the assigned path _must_ be
1161
1163
/// absolute. The closure returns a `bool` to allow or deny the download.
1164
+ ///
1165
+ /// By default a handler that allows all downloads is set to match browser behavior.
1162
1166
pub fn with_download_started_handler (
1163
1167
mut self ,
1164
1168
download_started_handler : impl FnMut ( String , & mut PathBuf ) -> bool + ' static ,
0 commit comments