---
title: "webView(_:shouldInsert:replacing:given:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webeditingdelegate/webview(_:shouldinsert:replacing:given:)"
---

# webView(_:shouldInsert:replacing:given:)

Returns whether the user should be allowed to insert a node in place of a range of content.

## Declaration

```swift
optional func webView(_ webView: WebView!, shouldInsert node: DOMNode!, replacing range: DOMRange!, given action: WebViewInsertAction) -> Bool
```

## Parameters

- `webView`: The web view that the user is editing.
- `node`: The content to insert.
- `range`: The portion of the content that is replaced with node.
- `action`: Indicates the type of user action that initiated the insertion.

## Return Value

Return Value true if the user should be allowed to insert node in webView; otherwise, false.

## Discussion

Discussion This method may perform an alternate action—for example, insert a different node—and return false.

## See Also

### Related Documentation

- [webViewDidChange(_:)](webkit/webeditingdelegate/webviewdidchange(_:).md)
- [webView(_:shouldInsertText:replacing:given:)](webkit/webeditingdelegate/webview(_:shouldinserttext:replacing:given:).md)
