---
title: "webView(_:shouldPerformAction:fromSender:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webuidelegate/webview(_:shouldperformaction:fromsender:)"
---

# webView(_:shouldPerformAction:fromSender:)

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

## Declaration

```swift
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 doc://com.apple.webkit/documentation/WebKit/WebView-swift.class for information on actions a web view can perform.
- `sender`: The object that sent the action.

## Return Value

Return Value true if the action should be performed; otherwise, false.

## Discussion

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 false to perform a copy in some other way than the default.

## See Also

### Controlling Other Behaviors

- [webView(_:validate:defaultValidation:)](webkit/webuidelegate/webview(_:validate:defaultvalidation:).md)
