Class

WKUserScript

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

Declaration

@interface WKUserScript : NSObject

Topics

Initializing a Script

- initWithSource:injectionTime:forMainFrameOnly:

Returns an initialized user script that can be added to a user content controller.

Inspecting Script Information

source

The script’s source code.

injectionTime

The time when the script should be injected into the webpage.

forMainFrameOnly

A Boolean value indicating whether the script should be injected only into the main frame (YES) or into all frames (NO).

Constants

WKUserScriptInjectionTime

The time when a user script should be injected into a webpage.

Relationships

Inherits From

Conforms To

See Also

Scripts

WKUserContentController

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

WKScriptMessage

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

WKScriptMessageHandler

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