---
title: "userContentController(_:didReceive:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkscriptmessagehandler/usercontentcontroller(_:didreceive:)"
---

# userContentController(_:didReceive:)

Tells the handler that a webpage sent a script message.

## Declaration

```swift
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)
```

## Parameters

- `userContentController`: The user content controller that delivered the message to your handler.
- `message`: An object that contains the message details.

## Discussion

Discussion Use this method to respond to a message sent from the webpage’s JavaScript code. Use the message parameter to get the message contents and to determine the originating web view.

## See Also

### Receiving Messages

- [WKScriptMessage](webkit/wkscriptmessage.md)
