---
title: "webView(for:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensiontab/webview(for:)"
---

# webView(for:)

Called when the web view for the tab is needed.

## Declaration

```swift
optional func webView(for context: WKWebExtensionContext) -> WKWebView?
```

## Parameters

- `context`: The context in which the web extension is running.

## Discussion

Discussion The web view’s WKWebViewConfiguration must have its webExtensionController property set to match the controller of the given context; otherwise nil will be used. Defaults to nil if not implemented. If nil, some critical features will not be available for this tab, such as content injection or modification.
