<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: 18.4.0 -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtensionTab/shouldGrantPermissionsOnUserGesture(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKWebExtensionTab(im)shouldGrantPermissionsOnUserGestureForWebExtensionContext:"
  },
  "title" : "shouldGrantPermissionsOnUserGesture(for:)"
}
-->

# shouldGrantPermissionsOnUserGesture(for:)

Called to determine if permissions should be granted for the tab on user gesture.

```
optional func shouldGrantPermissionsOnUserGesture(for context: WKWebExtensionContext) -> Bool
```

## Parameters

`context`

The context in which the web extension is running.

## Discussion

This method allows the app to control granting of permissions on a per-tab basis when triggered by a user gesture. Implementing this method enables the app to dynamically manage `activeTab` permissions based on the tab’s current state, the content being accessed, or other custom criteria.

---

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)