# RestrictionAllowlist

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/RestrictionAllowlist.java+class:androidx.webkit.RestrictionAllowlist) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

*** ** * ** ***


```
@WebViewBuilder.Experimental
public final class RestrictionAllowlist
```

<br />

*** ** * ** ***

RestrictionAllowlist can be used to scope WebView behaviors to particular origin patterns.

Add a RestrictionAllowlist via `https://developer.android.com/reference/androidx/webkit/WebViewBuilder#addAllowlist(androidx.webkit.RestrictionAllowlist)`. For example:

```
WebView webview = new WebViewBuilder(WebViewBuilder.PRESET_LEGACY)
        .restrictJavaScriptInterfaces()
        .addAllowlist(new RestrictionAllowlist.Builder(Set.of("https://example.com"))
                .addJavaScriptInterface(someJavaScriptInterface, "myInterface")
                .build())
        .build();
```

This example creates a WebView where the `https://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)` and `https://developer.android.com/reference/android/webkit/WebView.html#removeJavascriptInterface(java.lang.String)` APIs are disabled, but adds an allowlist that injects the `someJavaScriptInterface` object as `window.myInterface` into JavaScript only for frames with the `https://example.com` origin.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/webkit/RestrictionAllowlist.Builder` RestrictionAllowlist builder. |