<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtensionContext/didCloseTab(_:windowIsClosing:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:So21WKWebExtensionContextC6WebKitE11didCloseTab_15windowIsClosingySo0abH0_p_SbtF"
  },
  "title" : "didCloseTab(_:windowIsClosing:)"
}
-->

# didCloseTab(_:windowIsClosing:)

Called by the app when a tab is closed to fire appropriate events with only this extension.

```
@MainActor @preconcurrency func didCloseTab(_ closedTab: any WKWebExtensionTab, windowIsClosing: Bool = false)
```

## Parameters

`closedTab`

The tab that was closed.

`windowIsClosing`

A Boolean value indicating whether the window containing the tab is also closing.

## Discussion

This method informs only the specific extension of the closure of a tab. If the intention is to inform all loaded extensions consistently, you should use the respective method on the extension controller instead.

## See Also

[`func didOpenTab(any WKWebExtensionTab)`](/documentation/WebKit/WKWebExtensionContext/didOpenTab(_:))

Called by the app when a new tab is opened to fire appropriate events with only this extension.

[`var openTabs: Set<AnyHashable>`](/documentation/WebKit/WKWebExtensionContext/openTabs)

A set of open tabs in all open windows that are exposed to 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)