---
title: "activate(for:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensiontab/activate(for:completionhandler:)"
---

# activate(for:completionHandler:)

Called to activate the tab, making it frontmost.

## Declaration

```swift
optional func activate(for context: WKWebExtensionContext, completionHandler: @escaping ((any Error)?) -> Void)
```

```swift
optional func activate(for context: WKWebExtensionContext) async throws
```

## Parameters

- `context`: The context in which the web extension is running.
- `completionHandler`: A block that must be called upon completion. It takes a single error argument, which should be provided if any errors occurred.

## Discussion

Discussion Upon activation, the tab should become the frontmost and either be the sole selected tab or be included among the selected tabs. No action is performed if not implemented.

## See Also

### Related Documentation

- [setSelected(_:for:completionHandler:)](webkit/wkwebextensiontab/setselected(_:for:completionhandler:).md)
