WebViewPolicy
ClassWebViewPolicy allows creators to control what websites are allowed to be loaded in the WebView.
- Available on all platforms
- 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.
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
Properties
Methods
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()
staticgetTypeName():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
getTypeName()
getTypeName():
string
Experimental
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Experimental
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
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
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean