---
title: "indexInWindow(for:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensiontab/indexinwindow(for:)"
---

# indexInWindow(for:)

Called when the index of the tab in the window is needed.

## Declaration

```swift
optional func indexInWindow(for context: WKWebExtensionContext) -> Int
```

## Parameters

- `context`: The context in which the web extension is running.

## Discussion

Discussion This method should be implemented for better performance. Defaults to the window’s tabs(for:) method to find the index if not implemented.
