<!--
{
  "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/WKWebExtensionContext/focusedWindow",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebExtensionContext(py)focusedWindow"
  },
  "title" : "focusedWindow"
}
-->

# focusedWindow

The window that currently has focus for this extension.

```
weak var focusedWindow: (any WKWebExtensionWindow)? { get }
```

## Discussion

Provides the window that currently has focus, as set by the [`didFocusWindow(_:)`](/documentation/WebKit/WKWebExtensionContext/didFocusWindow(_:)) method.

It will be `nil` if no window has focus or if a window has focus that is not visible to the extension. Initially populated by the window returned by the extension controller delegate method [`webExtensionController(_:focusedWindowFor:)`](/documentation/WebKit/WKWebExtensionControllerDelegate/webExtensionController(_:focusedWindowFor:)).

## See Also

[`didFocusWindow(_:)`](/documentation/WebKit/WKWebExtensionContext/didFocusWindow(_:))

Called by the app when a window gains focus to fire appropriate events with only this extension.



---

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)