The OpenD Programming Language

ICoreWebView2.AddWebResourceRequestedFilter

Adds a URI and resource context filter for the WebResourceRequested event. A web resource request with a resource context that matches this filter's resource context and a URI that matches this filter's URI wildcard string will be raised via the WebResourceRequested event.

The uri parameter value is a wildcard string matched against the URI of the web resource request. This is a glob style wildcard string in which a * matches zero or more characters and a ? matches exactly one character. These wildcard characters can be escaped using a backslash just before the wildcard character in order to represent the literal * or ?.

The matching occurs over the URI as a whole string and not limiting wildcard matches to particular parts of the URI. The wildcard filter is compared to the URI after the URI has been normalized, any URI fragment has been removed, and non-ASCII hostnames have been converted to punycode.

Specifying a nullptr for the uri is equivalent to an empty string which matches no URIs.

For more information about resource context filters, navigate to COREWEBVIEW2_WEB_RESOURCE_CONTEXT.

| URI Filter String | Request URI | Match | Notes | | ---- | ---- | ---- | ---- | | * | https://contoso.com/a/b/c | Yes | A single * will match all URIs | | *://contoso.com/* | https://contoso.com/a/b/c | Yes | Matches everything in contoso.com across all schemes | | *://contoso.com/* | https://example.com/?https://contoso.com/ | Yes | But also matches a URI with just the same text anywhere in the URI | | example | https://contoso.com/example | No | The filter does not perform partial matches | | *example | https://contoso.com/example | Yes | The filter matches across URI parts | | *example | https://contoso.com/path/?example | Yes | The filter matches across URI parts | | *example | https://contoso.com/path/?query#example | No | The filter is matched against the URI with no fragment | | *example | https://example | No | The URI is normalized before filter matching so the actual URI used for comparison is https://example/ | | *example/ | https://example | Yes | Just like above, but this time the filter ends with a / just like the normalized URI | | https://xn--qei.example/ | https://❤.example/ | Yes | Non-ASCII hostnames are normalized to punycode before wildcard comparison | | https://❤.example/ | https://xn--qei.example/ | No | Non-ASCII hostnames are normalized to punycode before wildcard comparison |

interface ICoreWebView2
HRESULT
AddWebResourceRequestedFilter
(
in LPCWSTR uri
,
in COREWEBVIEW2_WEB_RESOURCE_CONTEXT resourceContext
)

Meta