# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/webkit/RestrictionAllowlist "View this page in Java")

<br />

```
@WebViewBuilder.Experimental
class RestrictionAllowlist
```

<br />

*** ** * ** ***

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

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

```kotlin
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[addJavascriptInterface](https://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String))and[removeJavascriptInterface](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                                                                          |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[RestrictionAllowlist.Builder](https://developer.android.com/reference/kotlin/androidx/webkit/RestrictionAllowlist.Builder) RestrictionAllowlist builder. |