Skip to main content

WebViewPolicy

Class

WebViewPolicy allows creators to control what websites are allowed to be loaded in the WebView.

  • Available on all platforms
4 platform notes
  • SnapchatFully supported
    • Experimental API; it may change or be removed.
  • SPECSFully supported
    • Experimental API; it may change or be removed.
  • Camera Kit WebFully supported
    • Experimental API; it may change or be removed.
  • Camera Kit MobileFully supported
    • Experimental API; it may change or be removed.

Platform details

  • Snapchat — Fully supported. Experimental API; it may change or be removed

  • SPECS — Fully supported. Experimental API; it may change or be removed

  • Camera Kit Web — Fully supported. Experimental API; it may change or be removed

  • Camera Kit Mobile — Fully supported. Experimental API; it may change or be removed

Experimental

WebViewPolicy allows creators to control what websites are allowed to be loaded in the WebView. This can be helpful to prevent users from navigating away from your desired webpage through external links.

Note: Partial matches are now currently supported but subdomains are. *snap.com is not supported. *.snap.com is supported.

Note: * is not supported for complex patterns but a single * on its own can be used to represent "all".

Note: snap.com would be the same as *.snap.com.

Index

Example

// Create the options
var resolution = new vec2(512, 512);
var options = RemoteServiceModule.createWebViewOptions(resolution);
optionsp.allow = [ "snap.com", "snapchat.com" ];
options.block = [ "*" ];
const resolution = new vec2(512,512);
const options = RemoteServiceModule.createWebViewOptions(resolution);

Extends

Properties

allow

allow: string[]

Experimental

Set an allow list of websites that can be loaded.

Note: Default is to allow any website.

Note: The platform may block websites.

Note: A platform blocked website may not be overridden using this property.

Default Value

[]
@experimental

block

block: string[]

Experimental

Set a block list of websites that will not be loaded.

Note: Default is to not block any website.

Note: A platform allowed website can be blocked by this property.

Default Value

[]
@experimental

Methods

getTypeName()

static getTypeName(): TypeName<WebViewPolicy>

Experimental

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<WebViewPolicy>

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Experimental

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Experimental

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Experimental

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame