Instance Method

addScriptMessageHandler:name:

Adds a script message handler.

Declaration

- (void)addScriptMessageHandler:(id<WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name;

Parameters

scriptMessageHandler

The message handler to add.

name

The name of the message handler.

Discussion

Adding a script message handler with name name

causes the JavaScript function window.webkit.messageHandlers.name.postMessage(messageBody) to be defined in all frames in all web views that use the user content controller.