---
title: "extensionContext(for:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensioncontroller/extensioncontext(for:)-2kr4"
---

# extensionContext(for:)

Returns a loaded extension context matching the specified URL.

## Declaration

```swift
func extensionContext(for URL: URL) -> WKWebExtensionContext?
```

## Parameters

- `URL`: The URL to lookup.

## Return Value

Return Value An extension context or nil if no match was found.

## Discussion

Discussion This method is useful for determining the extension context to use when about to navigate to an extension URL. For example, you could use this method to retrieve the appropriate extension context and then use its webViewConfiguration property to configure a web view for loading that URL.
