You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specs/FileTypePolicy.md
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,10 @@ File Type Policy API
2
2
===
3
3
4
4
# Background
5
-
When saving a file with original SaveFilePicker, a security alert might be
6
-
prompted, because the browser applies the [file type policies](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-security-downloads-interruptions#file-types-requiring-a-gesture)
7
-
to protect end users. However, in a WebView2 build App, when end users try
5
+
When saving a file with the standard SaveFilePicker (window.showSaveFilePicker),
6
+
the user might receive a security alert, as the second prompt to confirm the unsafe file type.
7
+
It's because the browser applies the [file type policies](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-security-downloads-interruptions#file-types-requiring-a-gesture)
8
+
to protect end users. However, in an app that is using WebView2, when end users try
8
9
to save a file with a certain file extension, they usually can trust the
9
10
host App, domain and file extension. So, we provide the App developers the
10
11
File Type Policy API to manage the file type policies dynamically.
@@ -13,17 +14,16 @@ We'd appreciate your feedback.
13
14
14
15
# Description
15
16
16
-
We proposed the `CoreWebView2.SaveFileSecurityCheckStarting` event. You can register
17
-
this event to get the file path, file extension and URI source information,
18
-
when end users try to save a file from your App. Then you can apply your own
19
-
rules to allow save the file with, or without a default warning dialog;
17
+
We proposed the `CoreWebView2.SaveFileSecurityCheckStarting` event. As a developer, you can register a handler on
18
+
this event to get the file path, file extension and URI source information. Then you can apply your own
19
+
rules to allow save the file without a default file type policy security warning UI;
20
20
to cancel the saving; and even to create your own UI to manage runtime
21
21
file type policies.
22
22
23
23
# Examples
24
24
## Win32 C++
25
25
This example shows suppressing file type policy, security dialog, and
26
-
allow to save the file directly. It also blocks saving the exe file.
26
+
allows saving eml files directly. It also blocks saving exe files.
27
27
The sample code will register the event with custom rules.
0 commit comments