<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: 18.4.0 -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtensionController/extensionContext(for:)-6ecpm",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebExtensionController(im)extensionContextForExtension:"
  },
  "title" : "extensionContext(for:)"
}
-->

# extensionContext(for:)

Returns a loaded extension context for the specified extension.

```
func extensionContext(for extension: WKWebExtension) -> WKWebExtensionContext?
```

## Parameters

`extension`

An extension to lookup.

## Return Value

An extension context or `nil` if no match was found.

## See Also

[`extensions`](/documentation/WebKit/WKWebExtensionController/extensions)

A set of all the currently loaded extensions.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)