<!--
{
  "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/WKWebExtensionController/didCloseTab(_:windowIsClosing:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:So24WKWebExtensionControllerC6WebKitE11didCloseTab_15windowIsClosingySo0abH0_p_SbtF"
  },
  "title" : "didCloseTab(_:windowIsClosing:)"
}
-->

# didCloseTab(_:windowIsClosing:)

Should be called by the app when a tab is closed to fire appropriate events with all loaded web extensions.

```
@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 all loaded extensions of the closing of a tab, ensuring consistent understanding across extensions.

If the intention is to inform only a specific extension, you should use the respective method on that extension’s context instead.

## See Also

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

Should be called by the app when a new tab is opened to fire appropriate events with all loaded web 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)