---
title: "handleJavaScriptPrompt(message:defaultText:initiatedBy:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webpage/dialogpresenting/handlejavascriptprompt(message:defaulttext:initiatedby:)"
---

# handleJavaScriptPrompt(message:defaultText:initiatedBy:)

A JavaScript prompt() function has been invoked.

## Declaration

```swift
@MainActor func handleJavaScriptPrompt(message: String, defaultText: String?, initiatedBy frame: WebPage.FrameInfo) async -> WebPage.JavaScriptPromptResult
```

## Parameters

- `message`: The message provided by JavaScript.
- `defaultText`: The initial text provided by JavaScript, intended to be displayed in some text entry field.
- `frame`: Information about the frame whose JavaScript process initiated this call.

## Return Value

Return Value The result of handling the invocation; if the result is affirmative, the response will include some text returned to JavaScript.
