A WKUser
object provides a way for JavaScript to post messages and inject user scripts to a web view.
SDKs
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
Framework
- Web
Kit
Declaration
@interface WKUserContentController : NSObject
A WKUser
object provides a way for JavaScript to post messages and inject user scripts to a web view.
SDKs
Framework
@interface WKUserContentController : NSObject
- add Script Message Handler: name:
Adds a script message handler.
- add User Script:
Adds a user script.
- remove All User Scripts
Removes all associated user scripts.
- remove Script Message Handler For Name:
Removes a script message handler.
user Scripts
The user scripts associated with the user content controller.
- add Content Rule List:
Adds a list of content rules.
- remove Content Rule List:
Removes a rules list.
- remove All Content Rule Lists
Removes all rules lists.
WKContent Rule List
A compiled list of rules to apply to web content.
WKScript Message
A WKScript
object contains information about a message sent from a webpage.
WKUser Script
A WKUser
object represents a script that can be injected into a webpage.
WKScript Message Handler
A class conforming to the WKScript
protocol provides a method for receiving messages from JavaScript running in a webpage.