---
title: "webView(_:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkuidelegate/webview(_:runjavascriptconfirmpanelwithmessage:initiatedbyframe:completionhandler:)"
---

# webView(_:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)

Displays a JavaScript confirm panel.

## Declaration

```swift
optional func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping @MainActor @Sendable (Bool) -> Void)
```

```swift
optional func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo) async -> Bool
```

## Parameters

- `webView`: The web view invoking the delegate method.
- `message`: The message to be displayed.
- `frame`: Information about the frame whose JavaScript process initiated this call.
- `completionHandler`: The completion handler to call after the confirm panel has been dismissed. Pass doc://com.apple.documentation/documentation/Swift/true if the user chose OK, and pass doc://com.apple.documentation/documentation/Swift/false if the user chose Cancel.

## Discussion

Discussion For user security, implementations of this method should call attention to the fact that a specific website controls the content in this panel. A simple formula for identifying the controlling website is frame.request.URL.host. The panel should have two buttons, typically OK and Cancel.

## See Also

### Displaying UI panels

- [webView(_:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)](webkit/wkuidelegate/webview(_:runjavascriptalertpanelwithmessage:initiatedbyframe:completionhandler:).md)
- [webView(_:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)](webkit/wkuidelegate/webview(_:runjavascripttextinputpanelwithprompt:defaulttext:initiatedbyframe:completionhandler:).md)
- [webView(_:showLockdownModeFirstUseMessage:completionHandler:)](webkit/wkuidelegate/webview(_:showlockdownmodefirstusemessage:completionhandler:).md)
- [WKDialogResult](webkit/wkdialogresult.md)
