<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebFrameLoadDelegate/webView(_:willClose:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WebFrameLoadDelegate(im)webView:willCloseFrame:"
  },
  "title" : "webView(_:willClose:)"
}
-->

# webView(_:willClose:)

Called when a frame will be closed.

```
optional func webView(_ sender: WebView!, willClose frame: WebFrame!)
```

## Parameters

`sender`

The web view containing the frame.

`frame`

The frame being loaded.

## Discussion

Called right before WebKit is done with `frame` and the objects it owns.

## See Also

[`webView(_:willPerformClientRedirectTo:delay:fire:for:)`](/documentation/WebKit/WebFrameLoadDelegate/webView(_:willPerformClientRedirectTo:delay:fire:for:))

Called when a frame receives a client redirect and before it is fired.



---

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)