MicrosoftEdge / WebView2Feedback

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

How to disable download protection #1902

Open viethuyphan opened 3 years ago

viethuyphan commented 3 years ago

Hi there,

I'm using WPF Webview2 to render webpages. I would like to disable download protection feature in order to not show warning dialog when I download a harmful file (.eml file in my case). I tried to add some additional browser arguments as bellow but it didn't work, the warning dialog is still displayed: --disable-features=msSmartScreenProtection --safebrowsing-disable-download-protection --safebrowsing-disable-extension-blacklist

var coreViewOptions = new CoreWebView2EnvironmentOptions(
                "--disable-features=msSmartScreenProtection --safebrowsing-disable-download-protection --safebrowsing-disable-extension-blacklist", "de");

var webView2Environment = await CoreWebView2Environment.CreateAsync(null, null, coreViewOptions);

await webView.EnsureCoreWebView2Async(webView2Environment);

image

Are there any missing arguments? Or Are there any other ways to disable download protection?

Thanks, Huy

AB#36984714

champnic commented 2 years ago

Hey @viethuyphan - would you mind sharing a screenshot of the download protection dialog you are referencing?

viethuyphan commented 2 years ago

Hi @champnic,

Here it is. Sorry for my mistake. It should be attached into the original post.

image

Hope it helps, Huy

champnic commented 2 years ago

Thanks @viethuyphan for the clarification! Looks like that "harmful" detection is separate from SmartScreen. I haven't found a way or flag to turn it off.

If you are ok with hiding the UI altogether you can handle the DownloadStarting event. https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.downloadstarting?view=webview2-dotnet-1.0.1056-prerelease

Otherwise, would you want me to open this as a feature request?

viethuyphan commented 2 years ago

Hi @champnic ,

Thanks for your suggestion. Yes, please open this as a feature request. I think it will be useful not only for me but also others.

Regards, Huy

sono-T commented 2 years ago

Thanks @viethuyphan for the clarification! Looks like that "harmful" detection is separate from SmartScreen. I haven't found a way or flag to turn it off.

If you are ok with hiding the UI altogether you can handle the DownloadStarting event. https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.downloadstarting?view=webview2-dotnet-1.0.1056-prerelease

Otherwise, would you want me to open this as a feature request?

Hi @champnic,

Yes please open the feature request for it, I need it as well.

Thanks, Tho

vhphuocvo commented 2 years ago

Thanks @viethuyphan for the clarification! Looks like that "harmful" detection is separate from SmartScreen. I haven't found a way or flag to turn it off.

If you are ok with hiding the UI altogether you can handle the DownloadStarting event. https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.downloadstarting?view=webview2-dotnet-1.0.1056-prerelease

Otherwise, would you want me to open this as a feature request?

Hello @champnic ,

Yes please help to create this as a feature request asap, this's crictical for user when using WebView2, i also have the same problem with this protection dialog and can't work around to disable it.

Thanks Phuoc

champnic commented 2 years ago

Thanks for the feedback - I've opened this as a scenario on our backlog!

viethuyphan commented 1 year ago

@champnic Do you have any updates on this topic?

nishitha-burman commented 10 months ago

Hi @viethuyphan, @sono-T, and @vhphuocvo, are there scenarios where you would like this dialog enabled?