### Class

# WebKit2 UserContentManager

#### Description [src]

    class WebKit2.UserContentManager : GObject.Object {
      parent: GObject
    }

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 passed to webkit_web_view_new_with_user_content_manager(). 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.

Available since: 2.6

#### Instance methods

###### webkit_user_content_manager_add_filter

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

Available since: 2.24

###### webkit_user_content_manager_add_script

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

Available since: 2.6

###### webkit_user_content_manager_add_style_sheet

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

Available since: 2.6

###### webkit_user_content_manager_register_script_message_handler

Registers a new user script message handler.

Available since: 2.8

###### webkit_user_content_manager_register_script_message_handler_in_world

Registers a new user script message handler in script world.

Available since: 2.22

###### webkit_user_content_manager_remove_all_filters

Removes all content filters from the given `WebKitUserContentManager`.

Available since: 2.24

###### webkit_user_content_manager_remove_all_scripts

Removes all user scripts from the given `WebKitUserContentManager`.

Available since: 2.6

###### webkit_user_content_manager_remove_all_style_sheets

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

Available 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.

Available since: 2.26

###### webkit_user_content_manager_remove_script

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

Available since: 2.32

###### webkit_user_content_manager_remove_style_sheet

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

Available since: 2.32

###### webkit_user_content_manager_unregister_script_message_handler

Unregisters a previously registered message handler.

Available 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`.

Available 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.<name>.postMessage()`, after registering `<name>` using `webkit_user_content_manager_register_script_message_handler()`

Available since: 2.8

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

###### GObject.Object::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
      );

    }

###### 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.