<!--
{
  "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/WKWebExtensionWindow/windowState(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKWebExtensionWindow(im)windowStateForWebExtensionContext:"
  },
  "title" : "windowState(for:)"
}
-->

# windowState(for:)

Called when the state of the window is needed.

```
optional func windowState(for context: WKWebExtensionContext) -> WKWebExtension.WindowState
```

## Parameters

`context`

The context in which the web extension is running.

## Discussion

Defaults to[`WKWebExtension.WindowState.normal`](/documentation/WebKit/WKWebExtension/WindowState/normal) if not implemented.

---

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)