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

# webViewClose(_:)

Closes a web view in a window.

```
optional func webViewClose(_ sender: WebView!)
```

## Parameters

`sender`

The web view that sent the message.

## Discussion

If you display multiple web views in a window then you might want to close only `sender` in your implementation. By default, this method sends the <doc://com.apple.documentation/documentation/AppKit/NSWindow/close()> method to the <doc://com.apple.documentation/documentation/AppKit/NSWindow> object that contains `sender`.

---

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)