---
title: "webView(_:runBeforeUnloadConfirmPanelWithMessage:initiatedBy:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webuidelegate/webview(_:runbeforeunloadconfirmpanelwithmessage:initiatedby:)"
---

# webView(_:runBeforeUnloadConfirmPanelWithMessage:initiatedBy:)

Displays a confirmation panel containing the specified message before a window closes.

## Declaration

```swift
optional func webView(_ sender: WebView!, runBeforeUnloadConfirmPanelWithMessage message: String!, initiatedBy frame: WebFrame!) -> Bool
```

## Parameters

- `sender`: The web view that sent the message.
- `message`: The message to display in the panel.
- `frame`: The web frame whose JavaScript initiated this call.

## Return Value

Return Value true if the user clicked the OK button; otherwise, false.

## Discussion

Discussion Use this method to include a message in the confirmation panel in addition to the message supplied by the webpage. The confirmation panel should contain OK and Cancel buttons.

## See Also

### Opening Panels

- [webView(_:runJavaScriptAlertPanelWithMessage:initiatedBy:)](webkit/webuidelegate/webview(_:runjavascriptalertpanelwithmessage:initiatedby:).md)
- [webView(_:runJavaScriptConfirmPanelWithMessage:initiatedBy:)](webkit/webuidelegate/webview(_:runjavascriptconfirmpanelwithmessage:initiatedby:).md)
- [webView(_:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedBy:)](webkit/webuidelegate/webview(_:runjavascripttextinputpanelwithprompt:defaulttext:initiatedby:).md)
- [webView(_:runOpenPanelForFileButtonWith:)](webkit/webuidelegate/webview(_:runopenpanelforfilebuttonwith:).md)
- [webView(_:runOpenPanelForFileButtonWith:allowMultipleFiles:)](webkit/webuidelegate/webview(_:runopenpanelforfilebuttonwith:allowmultiplefiles:).md)
