Previous topicNext topic
Help > Methods >
SetShieldLevel

SetShieldLevel Method

Defines a filtering level of the displayed page. Eliminates the loading of parts of documents not coming from the domain of the page being loaded. Partly works as an AdBlocker

Syntax

object.SetShieldLevel(ShieldLevel As oShieldFilterPower, ShieldException As oShieldException, [DoRedraw As Boolean = Vrai])

The SetShieldLevel method syntax has these parts:

Element Description
Object The object placeholder represents an OrdoWebView2 control
ShieldLevel

oShieldFilterPower, Sets shield power
    oNone = 0
    oModerate = 1
    oMedium = 2
    oMax = 3
See remarks below for an example

ShieldException

oShieldException. Defines exceptions to the filter rule set by ShieldLevel
    oNoException = 0
    oDocument = 1        Elements of type Document will be displayed even if they had to be filtered
    oImage = 2              Elements of type Image will be displayed even if they had to be filtered
    oMedia = 4             Elements of type Media (Video...) will be displayed even if they had to be filtered
    oFont = 8                Elements of type Font will be displayed even if they had to be filtered
    oScript = 16            Elements of type Script will be displayed or executed even if they had to be filtered
these exceptions can be combined with an OR operator

DoRedraw Boolean, optional, if True (Default) sends a redraw request to the ShiedChanged event

Remarks     

  • To understand the filtering method :
    if the user consults the web
    page "https://freeware.ordoconcept.net/OrdoWebview2.php"
    the page site domain is "freeware.ordoconcept.net"

    • If ShieldLevel = oModerate ' (1) the control will only display the elements of the page whose URL contains "ordoconcept"

    • If ShieldLevel = oMedium ' (2) the control will only display the elements of the page whose URL contains "ordoconcept.net"

    • If ShieldLevel = oMax ' (3) the control will only display the elements of the page whose URL contains "freeware.ordoconcept.net"

  • this filtering can be tempered by defining an exception with ShielException

    • For example if ShielException = oImage '(2) all the images of the page will be displayed even if they do not come from the site domain

  • Warning: If ShieldLevel is different from oNone (0), the WebResourceRequested event will no longer be triggered, because it is used internally by the control to manage the shield.