@@ -38,22 +38,25 @@ label functionality on trusted domains.
3838
3939### C++ Sample
4040``` cpp
41- void ConfigureAllowlist ()
41+ void ConfigurePageInteractionAllowlist ()
4242{
4343 wil::com_ptr<ICoreWebView2Profile> profile;
4444 CHECK_FAILURE (m_webView->get_Profile(&profile));
4545
4646 auto profile9 = profile.try_query<ICoreWebView2Profile9>();
4747 if (profile9) {
48- LPCWSTR allowlist[] = {
49- L"https://intranet.company.com/*",
50- L"https://*.company.com/*",
48+ LPCWSTR allowedUrls[] = {
49+ // Allow main domain and all its subdomains
50+ L"https://trusted-domain.com/*",
51+ L"https://*.trusted-domain.com/*",
52+
53+ // Allow specific partner domain and all its pages
5154 L"https://trusted-partner.com/*"
5255 };
5356
54- CHECK_FAILURE (profile9->SetPageInteractionRestrictionManagerAllowlist (
55- static_cast<UINT32 >(std::size(allowlist )),
56- allowlist ));
57+ CHECK_FAILURE (profile9->SetPageInteractionRestrictionManagerAllowList (
58+ static_cast<UINT32 >(std::size(allowedUrls )),
59+ allowedUrls ));
5760 }
5861}
5962
@@ -63,14 +66,17 @@ void ConfigureAllowlist()
6366``` csharp
6467var profile = webView2 .CoreWebView2 .Profile ;
6568
66- var allowlist = new List < string >
69+ var allowedUrls = new string []
6770{
68- " https://intranet.company.com/*" ,
69- " https://*.company.com/*" ,
71+ // Allow main domain and all its subdomains
72+ " https://trusted-domain.com/*" ,
73+ " https://*.trusted-domain.com/*" ,
74+
75+ // Allow specific partner domain and all its pages
7076 " https://trusted-partner.com/*"
7177};
7278
73- profile .PageInteractionRestrictionManagerAllowlist = allowlist ;
79+ profile .SetPageInteractionRestrictionManagerAllowList ( allowedUrls ) ;
7480```
7581
7682
@@ -201,22 +207,7 @@ void WebView_SensitivityLabelChanged(object sender, CoreWebView2SensitivityLabel
201207## Allow listing
202208### C++
203209
204- ```
205- /// This is the ICoreWebView2Profile interface for PageInteractionRestrictionManager allowlist management.
206- [uuid(a15dadcf-8924-54c2-9624-1b765abdb796), object, pointer_default(unique)]
207- interface ICoreWebView2Profile9 : IUnknown {
208- /// Gets the allowlist of URLs that are allowed to access the PageInteractionRestrictionManager API.
209- ///
210- /// This method retrieves the current allowlist configured for this profile.
211- /// The returned allowlist contains URL patterns that determine which web pages
212- /// can access the PageInteractionRestrictionManager functionality.
213- ///
214- /// The caller must free the returned string array with `CoTaskMemFree`.
215- HRESULT GetPageInteractionRestrictionManagerAllowlist(
216- [out] UINT32* allowlistCount,
217- [out] LPWSTR** allowlist
218- );
219-
210+ ``` cpp
220211 // / Sets the allowlist of URLs that are allowed to access the PageInteractionRestrictionManager API.
221212 // /
222213 // / This method configures an allowlist of URLs that determines which web pages
@@ -241,7 +232,7 @@ interface ICoreWebView2Profile9 : IUnknown {
241232 // /
242233 // / Changes take effect immediately for all WebView2 instances using this profile.
243234 // / The allowlist is persisted across sessions.
244- HRESULT SetPageInteractionRestrictionManagerAllowlist (
235+ HRESULT SetPageInteractionRestrictionManagerAllowList (
245236 [in] UINT32 allowlistCount,
246237 [in] LPCWSTR* allowlist
247238 );
@@ -253,9 +244,9 @@ namespace Microsoft.Web.WebView2.Core
253244{
254245 runtimeclass CoreWebView2Profile
255246 {
256- /// Controls which URLs are allowed to access the PageInteractionRestrictionManager API.
247+ /// Sets the allowlist of URLs that are allowed to access the PageInteractionRestrictionManager API.
257248 ///
258- /// This property manages an allowlist of URLs that determines which web pages
249+ /// This method sets an allowlist of URLs that determines which web pages
259250 /// can use the PageInteractionRestrictionManager API. Only URLs that match
260251 /// entries in this allowlist (either exact matches or wildcard patterns) will
261252 /// have access to the PageInteractionRestrictionManager functionality.
@@ -270,7 +261,7 @@ namespace Microsoft.Web.WebView2.Core
270261 /// | `https://example.com/*` | `https://example.com/page` | Yes | Wildcard matches any path |
271262 /// | `*://example.com/*` | `https://example.com/page` | Yes | Wildcard matches any scheme |
272263 /// | `*` | `https://any-site.com` | Yes | Wildcard matches all URLs |
273- IVectorView <String> PageInteractionRestrictionManagerAllowlist { get; set; } ;
264+ void SetPageInteractionRestrictionManagerAllowList(Windows.Foundation.Collections.IIterable <String> allowList) ;
274265 }
275266}
276267```
0 commit comments