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

# didActivateTab(_:previousActiveTab:)

Should be called by the app when a tab is activated to notify all loaded web extensions.

```
@MainActor @preconcurrency func didActivateTab(_ activatedTab: any WKWebExtensionTab, previousActiveTab previousTab: (any WKWebExtensionTab)? = nil)
```

## Parameters

`activatedTab`

The tab that has become active.

`previousTab`

The tab that was active before. This parameter can be \c nil if there was no previously active tab.

## Discussion

This method informs all loaded extensions of the tab activation, ensuring consistent state awareness across extensions.

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

---

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)