A class conforming to the WKScriptMessageHandler protocol provides a method for receiving messages from JavaScript running in a webpage.


protocol WKScriptMessageHandler


Receiving Messages

func userContentController(WKUserContentController, didReceive: WKScriptMessage)

Invoked when a script message is received from a webpage.



Inherits From

See Also


class WKUserContentController

A WKUserContentController object provides a way for JavaScript to post messages and inject user scripts to a web view.

class WKScriptMessage

A WKScriptMessage object contains information about a message sent from a webpage.

class WKUserScript

A WKUserScript object represents a script that can be injected into a webpage.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software