MicrosoftEdge / WebView2Feedback

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

Add API for disabling file uploads #1544

Open hanzzzzz opened 3 years ago

hanzzzzz commented 3 years ago

Is your feature request related to a problem? Please describe. I'm developing an application that should show a web browser with very limited interaction possibilities. So far, disabling the context menus, preventing camera/microphone access etc. is possible, but at the moment I cannot prevent file uploads.

Describe the solution you'd like and alternatives you've considered For me a very simple API, e.g. ICoreWebView2Settings::put_AreFileUploadsEnabled(BOOL ...) would be sufficient. I'm aware that in #1479 a similar request is being made, but maybe this very simple API could make it into the product earlier.

Similarly, being able to disable Drag&Drop like requested in #278 in a very simple manner, e.g. ICoreWebView2Settings::put_IsDragAndDropEnabled(BOOL ...), would be fantastic.

AB#30958081

champnic commented 3 years ago

Hey @hanzzzzz - thanks for the feature request! I've added this info to the scenario that's on our backlog. It sounds like there might be a way to accomplish this in script that may be able to unblock you in the meantime - I'm asking for more information and will share when I know more.

jasonstephen15 commented 3 years ago

Hi @hanzzzzz - you may be able to inject script via our ExecuteScriptAsync API and disable upload buttons as done in this tutorial. Please let me know if this doesn't work for you, or need something more granular.

hanzzzzz commented 3 years ago

Hi @jasonstephen15, thanks for the hint. Since I need to disable all possible methods of uploading a file, and I'm not sure if that's possible using a script which is run after loading a website, I assume that I need a more generic way - probably provided by the WebView2 SDK. If you have a different opinion and a starting point for me to accomplish this in another way with the current SDK I'd be more than happy to hear from you again!

jasonstephen15 commented 3 years ago

Agreed, you'd have to find and disable all the upload entry points, which might be alot of overhead, but perhaps still doable? We will keep this feature request open for now, I think this is a valid scenario, that might be an addition to the download API.