<!--
{
  "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/setZoomFactor(_:for:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKWebExtensionTab(im)setZoomFactor:forWebExtensionContext:completionHandler:"
  },
  "title" : "setZoomFactor(_:for:completionHandler:)"
}
-->

# setZoomFactor(_:for:completionHandler:)

Called to set the zoom factor of the tab.

```
optional func setZoomFactor(_ zoomFactor: Double, for context: WKWebExtensionContext, completionHandler: @escaping ((any Error)?) -> Void)
```

## Parameters

`zoomFactor`

The desired zoom factor for the tab.

`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

Sets [`pageZoom`](/documentation/WebKit/WKWebView/pageZoom) of the tab’s web view if not implemented.

## See Also

[`zoomFactor(for:)`](/documentation/WebKit/WKWebExtensionTab/zoomFactor(for:))

Called when the zoom factor of the tab is needed.



---

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)