WebKit2.UserScript.new
Description: Reference for WebKit2.UserScript.new

### Function

# WebKit2 UserScriptnew

since: 2.6

#### Declaration [src]

    WebKitUserScript*
    webkit_user_script_new (
      const gchar* source,
      WebKitUserContentInjectedFrames injected_frames,
      WebKitUserScriptInjectionTime injection_time,
      const gchar* const* allow_list,
      const gchar* const* block_list
    )

#### Description [src]

Creates a new user script.

Scripts can be applied to some URIs only by passing non-null values for `allow_list` or `block_list`. Passing a `NULL` allow_list implies that all URIs are on the allow_list. The script is applied if an URI matches the allow_list and not the block_list. URI patterns must be of the form `[protocol]://[host]/[path]`, where the host and path components can contain the wildcard character (`*`) to represent zero or more other characters.

Available since: 2.6

#### Parameters

`source`

  Type: `const gchar*`

  Source code of the user script.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`injected_frames`

  Type: `WebKitUserContentInjectedFrames`

  A `WebKitUserContentInjectedFrames` value.

`injection_time`

  Type: `WebKitUserScriptInjectionTime`

  A `WebKitUserScriptInjectionTime` value.

`allow_list`

  Type: An array of `gchar*`

  An allow_list of URI patterns or `NULL`.

  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The data is owned by the caller of the function.
  Each element is a NUL terminated UTF-8 string.

`block_list`

  Type: An array of `gchar*`

  A block_list of URI patterns or `NULL`.

  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The data is owned by the caller of the function.
  Each element is a NUL terminated UTF-8 string.

#### Return value

Type: `WebKitUserScript`

A new `WebKitUserScript`.

The caller of the function takes ownership of the data, and is responsible for freeing it.