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

# webView(_:shouldPerformAction:fromSender:)

Returns a Boolean value that indicates whether the action sent by the specified object should be performed.

```
optional func webView(_ webView: WebView!, shouldPerformAction action: Selector!, fromSender sender: Any!) -> Bool
```

## Parameters

`webView`

The web view that sent the message.

`action`

The action to perform. See [`WebView`](/documentation/WebKit/WebView-swift.class) for information on actions a web view can perform.

`sender`

The object that sent the action.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the action should be performed; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method allows the delegate to control the web view’s behavior when action methods are invoked. For example, if the action is `copy:`, the delegate can return <doc://com.apple.documentation/documentation/Swift/false> to perform a copy in some other way than the default.

---

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)