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

# webView(_:runJavaScriptAlertPanelWithMessage:initiatedBy:)

Displays a JavaScript alert panel containing the specified message.

```
optional func webView(_ sender: WebView!, runJavaScriptAlertPanelWithMessage message: String!, initiatedBy frame: WebFrame!)
```

## Parameters

`sender`

The web view that sent the message.

`message`

The message to display in the alert panel.

`frame`

The web frame whose JavaScript initiated this call.

## Discussion

This method displays an alert panel when JavaScript code calls `alert`. Delegates should visually indicate that this panel comes from JavaScript. The panel should contain a single OK button. No action is taken if you do not implement this method.

---

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)