### Class

# WebKit2 UserContentManager

since: 2.6

#### Description [src]

    class WebKit2.UserContentManager : GObject.Object
    {
      priv: WebKitUserContentManagerPrivate*
    }

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.

Available since: 2.6

#### Ancestors

- GObject

#### Constructors

###### webkit_user_content_manager_new

Creates a new user content manager.

since: 2.6

#### Instance methods

###### webkit_user_content_manager_add_filter

Adds a `WebKitUserContentFilter` to the given `WebKitUserContentManager`.

since: 2.24

###### webkit_user_content_manager_add_script

Adds a `WebKitUserScript` to the given `WebKitUserContentManager`.

since: 2.6

###### webkit_user_content_manager_add_style_sheet

Adds a `WebKitUserStyleSheet` to the given `WebKitUserContentManager`.

since: 2.6

###### webkit_user_content_manager_register_script_message_handler

Registers a new user script message handler.

since: 2.8

###### webkit_user_content_manager_register_script_message_handler_in_world

Registers a new user script message handler in script world.

since: 2.22

###### webkit_user_content_manager_register_script_message_handler_with_reply

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

since: 2.40

###### webkit_user_content_manager_remove_all_filters

Removes all content filters from the given `WebKitUserContentManager`.

since: 2.24

###### webkit_user_content_manager_remove_all_scripts

Removes all user scripts from the given `WebKitUserContentManager`.

since: 2.6

###### webkit_user_content_manager_remove_all_style_sheets

Removes all user style sheets from the given `WebKitUserContentManager`.

since: 2.6

###### webkit_user_content_manager_remove_filter

Removes a filter from the given `WebKitUserContentManager`.

###### webkit_user_content_manager_remove_filter_by_id

Removes a filter by the given identifier.

since: 2.26

###### webkit_user_content_manager_remove_script

Removes a `WebKitUserScript` from the given `WebKitUserContentManager`.

since: 2.32

###### webkit_user_content_manager_remove_style_sheet

Removes a `WebKitUserStyleSheet` from the given `WebKitUserContentManager`.

since: 2.32

###### webkit_user_content_manager_unregister_script_message_handler

Unregisters a previously registered message handler.

since: 2.8

###### webkit_user_content_manager_unregister_script_message_handler_in_world

Unregisters a previously registered message handler in script world with name `world_name`.

since: 2.22

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

###### WebKit2.UserContentManager::script-message-received

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().

since: 2.8

###### WebKit2.UserContentManager::script-message-with-reply-received

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().

since: 2.40

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct WebKit2UserContentManagerClass {
      GObjectClass parent_class;
      void (* _webkit_reserved0) (
    void
      );
      void (* _webkit_reserved1) (
    void
      );
      void (* _webkit_reserved2) (
    void
      );
      void (* _webkit_reserved3) (
    void
      );

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.

`_webkit_reserved0: void (* _webkit_reserved0) ( void )`

  No description available.

`_webkit_reserved1: void (* _webkit_reserved1) ( void )`

  No description available.

`_webkit_reserved2: void (* _webkit_reserved2) ( void )`

  No description available.

`_webkit_reserved3: void (* _webkit_reserved3) ( void )`

  No description available.