Previous topicNext topic
Help > Methods >
Add_WebResourceRequestedFilter

Add_WebResourceRequestedFilter Method

Adds a URI filter and resource context filter for the WebResourceRequested event.

Syntax

object.Add_WebResourceRequestedFilter(strFilter As String, [FilterContext As oWebView2ResourceFilter])

The Add_WebResourceRequestedFilter method syntax has these parts:

Element Description
Object The object placeholder represents an OrdoWebView2 control
strFilter

String, The strFilter 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 ?.
A web resource request with a resource context that matches the FilterContext resource context and a URI that matches this filter's URI wildcard string will be raised via the WebResourceRequested event.
    See this link for an example

FilterContext

oWebView2ResourceFilter. A resource context filter to be added to the WebResourceRequested event.
    Filter_ALL = 0
    Filter_DOCUMENT = 1
    Filter_STYLESHEET = 2
    Filter_IMAGE = 3
    Filter_MEDIA = 4
    Filter_FONT = 5
    Filter_SCRIPT = 6
    Filter_XML_HTTP_REQUEST = 7
    Filter_FETCH = 8
    Filter_TEXT_TRACK = 9
    Filter_EVENT_SOURCE = 10
    Filter_WEBSOCKET = 11
    Filter_MANIFEST = 12
    Filter_SIGNED_EXCHANGE = 13
    Filter_PING = 14
    Filter_CSP_VIOLATION_REPORT = 15
    Filter_OTHER = 16