UserContentManager

class UserContentManager(pointer: <Error class: unknown class><<Error class: unknown class>>)

Manages user-defined content which affects web pages.

Using a #WebKitUserContentManager user CSS style sheets can be set to be injected in the web pages loaded by a #WebKitWebView, by webkit_user_content_manager_add_style_sheet().

To use a #WebKitUserContentManager, it must be created using webkit_user_content_manager_new(), and then used to construct a #WebKitWebView. User style sheets can be created with webkit_user_style_sheet_new().

User style sheets can be added and removed at any time, but they will affect the web pages loaded afterwards.

Since

2.6

Constructors

Link copied to clipboard
constructor()

Creates a new user content manager.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val webkitUserContentManagerPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard

Adds a #WebKitUserContentFilter to the given #WebKitUserContentManager.

Link copied to clipboard
fun addScript(script: UserScript)

Adds a #WebKitUserScript to the given #WebKitUserContentManager.

Link copied to clipboard
fun addStyleSheet(stylesheet: UserStyleSheet)

Adds a #WebKitUserStyleSheet to the given #WebKitUserContentManager.

Link copied to clipboard
fun connectScriptMessageReceived(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

This signal is emitted when JavaScript in a web view calls window.webkit.messageHandlers..postMessage(), after registering using webkit_user_content_manager_register_script_message_handler()

Link copied to clipboard
fun connectScriptMessageWithReplyReceived(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, reply: ScriptMessageReply) -> Boolean): <Error class: unknown class>

This signal is emitted when JavaScript in a web view calls window.webkit.messageHandlers..postMessage(), after registering using webkit_user_content_manager_register_script_message_handler_with_reply()

Link copied to clipboard
fun registerScriptMessageHandler(name: String, worldName: String? = null): Boolean

Registers a new user script message handler in script world.

Link copied to clipboard

Registers a new user script message handler in script world with name @world_name.

Link copied to clipboard

Removes all content filters from the given #WebKitUserContentManager.

Link copied to clipboard

Removes all user scripts from the given #WebKitUserContentManager

Link copied to clipboard

Removes all user style sheets from the given #WebKitUserContentManager.

Link copied to clipboard

Removes a filter from the given #WebKitUserContentManager.

Link copied to clipboard
fun removeFilterById(filterId: String)

Removes a filter by the given identifier.

Link copied to clipboard

Removes a #WebKitUserScript from the given #WebKitUserContentManager.

Link copied to clipboard

Removes a #WebKitUserStyleSheet from the given #WebKitUserContentManager.

Link copied to clipboard
fun unregisterScriptMessageHandler(name: String, worldName: String? = null)

Unregisters a previously registered message handler in script world with name @world_name. If null is passed as the @world_name, the default world will be used.