<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebPage/DialogPresenting/handleJavaScriptAlert(message:initiatedBy:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:6WebKit0A4PageC16DialogPresentingP21handleJavaScriptAlert7message11initiatedByySS_AC9FrameInfoVtYaF"
  },
  "title" : "handleJavaScriptAlert(message:initiatedBy:)"
}
-->

# handleJavaScriptAlert(message:initiatedBy:)

A JavaScript `alert()` function has been invoked.

```
@MainActor func handleJavaScriptAlert(message: String, initiatedBy frame: WebPage.FrameInfo) async
```

## Parameters

`message`

The message provided by JavaScript.

`frame`

Information about the frame whose JavaScript process initiated this call.

---

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)