## WebKitWebView

WebKitWebView — The central class of the WebKit2GTK+ API

## Synopsis

                        WebKitWebView;
    enum                WebKitLoadEvent;
    enum                WebKitPolicyDecisionType;
    enum                WebKitSaveMode;
    enum                WebKitViewMode;
    enum                WebKitInsecureContentEvent;
    enum                WebKitSnapshotOptions;
    enum                WebKitSnapshotRegion;

    #define             WEBKIT_EDITING_COMMAND_CUT
    #define             WEBKIT_EDITING_COMMAND_COPY
    #define             WEBKIT_EDITING_COMMAND_PASTE
    #define             WEBKIT_EDITING_COMMAND_SELECT_ALL
    #define             WEBKIT_EDITING_COMMAND_UNDO
    #define             WEBKIT_EDITING_COMMAND_REDO

    GtkWidget *         webkit_web_view_new                 (void);
    GtkWidget *         webkit_web_view_new_with_context    (WebKitWebContext *context);
    GtkWidget *         webkit_web_view_new_with_group      (WebKitWebViewGroup *group);
    WebKitWebContext *  webkit_web_view_get_context         (WebKitWebView *web_view);
    WebKitWebViewGroup * webkit_web_view_get_group          (WebKitWebView *web_view);
    void                webkit_web_view_load_uri            (WebKitWebView *web_view,
                                                             const gchar *uri);
    void                webkit_web_view_load_html           (WebKitWebView *web_view,
                                                             const gchar *content,
                                                             const gchar *base_uri);
    void                webkit_web_view_load_alternate_html (WebKitWebView *web_view,
                                                             const gchar *content,
                                                             const gchar *content_uri,
                                                             const gchar *base_uri);
    void                webkit_web_view_load_plain_text     (WebKitWebView *web_view,
                                                             const gchar *plain_text);
    void                webkit_web_view_load_request        (WebKitWebView *web_view,
                                                             WebKitURIRequest *request);
    gboolean            webkit_web_view_can_go_back         (WebKitWebView *web_view);
    void                webkit_web_view_go_back             (WebKitWebView *web_view);
    gboolean            webkit_web_view_can_go_forward      (WebKitWebView *web_view);
    void                webkit_web_view_go_forward          (WebKitWebView *web_view);
    const gchar *       webkit_web_view_get_title           (WebKitWebView *web_view);
    guint64             webkit_web_view_get_page_id         (WebKitWebView *web_view);
    void                webkit_web_view_reload              (WebKitWebView *web_view);
    void                webkit_web_view_reload_bypass_cache (WebKitWebView *web_view);
    void                webkit_web_view_stop_loading        (WebKitWebView *web_view);
    gboolean            webkit_web_view_is_loading          (WebKitWebView *web_view);
    gdouble             webkit_web_view_get_estimated_load_progress
                                                            (WebKitWebView *web_view);
    const gchar *       webkit_web_view_get_custom_charset  (WebKitWebView *web_view);
    void                webkit_web_view_set_custom_charset  (WebKitWebView *web_view,
                                                             const gchar *charset);
    WebKitBackForwardList * webkit_web_view_get_back_forward_list
                                                            (WebKitWebView *web_view);
    void                webkit_web_view_go_to_back_forward_list_item
                                                            (WebKitWebView *web_view,
                                                             WebKitBackForwardListItem *list_item);
    const gchar *       webkit_web_view_get_uri             (WebKitWebView *web_view);
    cairo_surface_t *   webkit_web_view_get_favicon         (WebKitWebView *web_view);
    void                webkit_web_view_set_settings        (WebKitWebView *web_view,
                                                             WebKitSettings *settings);
    WebKitSettings *    webkit_web_view_get_settings        (WebKitWebView *web_view);
    WebKitWindowProperties * webkit_web_view_get_window_properties
                                                            (WebKitWebView *web_view);
    void                webkit_web_view_set_zoom_level      (WebKitWebView *web_view,
                                                             gdouble zoom_level);
    gdouble             webkit_web_view_get_zoom_level      (WebKitWebView *web_view);
    void                webkit_web_view_can_execute_editing_command
                                                            (WebKitWebView *web_view,
                                                             const gchar *command,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            webkit_web_view_can_execute_editing_command_finish
                                                            (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                webkit_web_view_execute_editing_command
                                                            (WebKitWebView *web_view,
                                                             const gchar *command);
    WebKitFindController * webkit_web_view_get_find_controller
                                                            (WebKitWebView *web_view);
    WebKitWebInspector * webkit_web_view_get_inspector      (WebKitWebView *web_view);
    JSGlobalContextRef  webkit_web_view_get_javascript_global_context
                                                            (WebKitWebView *web_view);
    void                webkit_web_view_run_javascript      (WebKitWebView *web_view,
                                                             const gchar *script,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    WebKitJavascriptResult * webkit_web_view_run_javascript_finish
                                                            (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                webkit_web_view_run_javascript_from_gresource
                                                            (WebKitWebView *web_view,
                                                             const gchar *resource,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    WebKitJavascriptResult * webkit_web_view_run_javascript_from_gresource_finish
                                                            (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            webkit_web_view_can_show_mime_type  (WebKitWebView *web_view,
                                                             const gchar *mime_type);
    void                webkit_web_view_save                (WebKitWebView *web_view,
                                                             WebKitSaveMode save_mode,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GInputStream *      webkit_web_view_save_finish         (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);
    void                webkit_web_view_save_to_file        (WebKitWebView *web_view,
                                                             GFile *file,
                                                             WebKitSaveMode save_mode,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            webkit_web_view_save_to_file_finish (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);
    WebKitDownload *    webkit_web_view_download_uri        (WebKitWebView *web_view,
                                                             const char *uri);
    void                webkit_web_view_set_view_mode       (WebKitWebView *web_view,
                                                             WebKitViewMode view_mode);
    WebKitViewMode      webkit_web_view_get_view_mode       (WebKitWebView *web_view);
    gboolean            webkit_web_view_get_tls_info        (WebKitWebView *web_view,
                                                             GTlsCertificate **certificate,
                                                             GTlsCertificateFlags *errors);
    void                webkit_web_view_get_snapshot        (WebKitWebView *web_view,
                                                             WebKitSnapshotRegion region,
                                                             WebKitSnapshotOptions options,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    cairo_surface_t *   webkit_web_view_get_snapshot_finish (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);

                        WebKitJavascriptResult;
    WebKitJavascriptResult * webkit_javascript_result_ref   (WebKitJavascriptResult *js_result);
    void                webkit_javascript_result_unref      (WebKitJavascriptResult *js_result);
    JSGlobalContextRef  webkit_javascript_result_get_global_context
                                                            (WebKitJavascriptResult *js_result);
    JSValueRef          webkit_javascript_result_get_value  (WebKitJavascriptResult *js_result);

                        WebKitScriptDialog;
    enum                WebKitScriptDialogType;
    WebKitScriptDialogType webkit_script_dialog_get_dialog_type
                                                            (WebKitScriptDialog *dialog);
    const gchar *       webkit_script_dialog_get_message    (WebKitScriptDialog *dialog);
    void                webkit_script_dialog_confirm_set_confirmed
                                                            (WebKitScriptDialog *dialog,
                                                             gboolean confirmed);
    const gchar *       webkit_script_dialog_prompt_get_default_text
                                                            (WebKitScriptDialog *dialog);
    void                webkit_script_dialog_prompt_set_text
                                                            (WebKitScriptDialog *dialog,
                                                             const gchar *text);
    WebKitWebResource * webkit_web_view_get_main_resource   (WebKitWebView *web_view);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkWidget
                   +----GtkContainer
                         +----WebKitWebViewBase
                               +----WebKitWebView

      GBoxed
       +----WebKitJavascriptResult

      GBoxed
       +----WebKitScriptDialog

## Implemented Interfaces

WebKitWebView implements AtkImplementorIface and GtkBuildable.

## Properties

      "estimated-load-progress"  gdouble               : Read
      "favicon"                  gpointer              : Read
      "group"                    WebKitWebViewGroup*   : Read / Write / Construct Only
      "is-loading"               gboolean              : Read
      "title"                    gchar*                : Read
      "uri"                      gchar*                : Read
      "view-mode"                WebKitViewMode        : Read / Write
      "web-context"              WebKitWebContext*     : Read / Write / Construct Only
      "zoom-level"               gdouble               : Read / Write

## Signals

      "authenticate"                                   : Run Last
      "close"                                          : Run Last
      "context-menu"                                   : Run Last
      "context-menu-dismissed"                         : Run Last
      "create"                                         : Run Last
      "decide-policy"                                  : Run Last
      "enter-fullscreen"                               : Run Last
      "insecure-content-detected"                      : Run Last
      "leave-fullscreen"                               : Run Last
      "load-changed"                                   : Run Last
      "load-failed"                                    : Run Last
      "mouse-target-changed"                           : Run Last
      "permission-request"                             : Run Last
      "print"                                          : Run Last
      "ready-to-show"                                  : Run Last
      "resource-load-started"                          : Run Last
      "run-as-modal"                                   : Run Last
      "run-file-chooser"                               : Run Last
      "script-dialog"                                  : Run Last
      "submit-form"                                    : Run Last
      "web-process-crashed"                            : Run Last

## Description

WebKitWebView is the central class of the WebKit2GTK+ API. It is responsible for managing the drawing of the content and forwarding of events. You can load any URI into the WebKitWebView or a data string. With WebKitSettings you can control various aspects of the rendering and loading of the content.

Note that WebKitWebView is scrollable by itself, so you don't need to embed it in a GtkScrolledWindow.

## Details

### WebKitWebView

    typedef struct _WebKitWebView WebKitWebView;

### enum WebKitLoadEvent

    typedef enum {
        WEBKIT_LOAD_STARTED,
        WEBKIT_LOAD_REDIRECTED,
        WEBKIT_LOAD_COMMITTED,
        WEBKIT_LOAD_FINISHED
    } WebKitLoadEvent;

Enum values used to denote the different events that happen during a WebKitWebView load operation.

`WEBKIT_LOAD_STARTED` | A new load request has been made. No data has been received yet, empty structures have been allocated to perform the load; the load may still fail due to transport issues such as not being able to resolve a name, or connect to a port.
`WEBKIT_LOAD_REDIRECTED` | A provisional data source received a server redirect.
`WEBKIT_LOAD_COMMITTED` | The content started arriving for a page load. The necessary transport requirements are stabilished, and the load is being performed.
`WEBKIT_LOAD_FINISHED` | Load completed. All resources are done loading or there was an error during the load operation.

### enum WebKitPolicyDecisionType

    typedef enum {
        WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION,
        WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION,
        WEBKIT_POLICY_DECISION_TYPE_RESPONSE,
    } WebKitPolicyDecisionType;

Enum values used for determining the type of a policy decision during "decide-policy".

`WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION` | This type of policy decision is requested when WebKit is about to navigate to a new page in either the main frame or a subframe. Acceptable policy decisions are either `webkit_policy_decision_use()` or `webkit_policy_decision_ignore()`. This type of policy decision is always a WebKitNavigationPolicyDecision.

`WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION`

This type of policy decision is requested when WebKit is about to create a new window. Acceptable policy decisions are either `webkit_policy_decision_use()` or `webkit_policy_decision_ignore()`. This type of policy decision is always a WebKitNavigationPolicyDecision. These decisions are useful for implementing special actions for new windows, such as forcing the new window to open in a tab when a keyboard modifier is active or handling a special target attribute on <a> elements.

`WEBKIT_POLICY_DECISION_TYPE_RESPONSE`

This type of decision is used when WebKit has received a response for a network resource and is about to start the load. Note that these resources include all subresources of a page such as images and stylesheets as well as main documents. Appropriate policy responses to this decision are `webkit_policy_decision_use()`, `webkit_policy_decision_ignore()`, or `webkit_policy_decision_download()`. This type of policy decision is always a WebKitResponsePolicyDecision. This decision is useful for forcing some types of resources to be downloaded rather than rendered in the WebView or to block the transfer of resources entirely.

### enum WebKitSaveMode

    typedef enum {
        WEBKIT_SAVE_MODE_MHTML
    } WebKitSaveMode;

Enum values to specify the different ways in which a WebKitWebView can save its current web page into a self-contained file.

`WEBKIT_SAVE_MODE_MHTML` | Save the current page using the MHTML format.

### enum WebKitViewMode

    typedef enum {
        WEBKIT_VIEW_MODE_WEB,
        WEBKIT_VIEW_MODE_SOURCE
    } WebKitViewMode;

Enum values to specify the different ways in which a WebKitWebView can display a web page.

`WEBKIT_VIEW_MODE_WEB` | The normal view mode to display web contents.
`WEBKIT_VIEW_MODE_SOURCE` | The source mode to display web source code.

### enum WebKitInsecureContentEvent

    typedef enum {
        WEBKIT_INSECURE_CONTENT_RUN,
        WEBKIT_INSECURE_CONTENT_DISPLAYED
    } WebKitInsecureContentEvent;

Enum values used to denote the different events which can trigger the detection of insecure content.

`WEBKIT_INSECURE_CONTENT_RUN` | Insecure content has been detected by trying to execute any kind of logic (e.g. a script) from an untrusted source.
`WEBKIT_INSECURE_CONTENT_DISPLAYED` | Insecure content has been detected by trying to display any kind of resource (e.g. an image) from an untrusted source.

### enum WebKitSnapshotOptions

    typedef enum {
      WEBKIT_SNAPSHOT_OPTIONS_NONE = 0,
      WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING = 1 << 0,
    } WebKitSnapshotOptions;

Enum values used to specify options when taking a snapshot from a WebKitWebView.

`WEBKIT_SNAPSHOT_OPTIONS_NONE` | Do not include any special options.
`WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING` | Whether to include in the snapshot the highlight of the selected content.

### enum WebKitSnapshotRegion

    typedef enum {
      WEBKIT_SNAPSHOT_REGION_VISIBLE = 0,
      WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,
    } WebKitSnapshotRegion;

Enum values used to specify the region from which to get a WebKitWebView snapshot

`WEBKIT_SNAPSHOT_REGION_VISIBLE` | Specifies a snapshot only for the area that is visible in the webview
`WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT` | A snapshot of the entire document.

### WEBKIT_EDITING_COMMAND_CUT

    #define WEBKIT_EDITING_COMMAND_CUT "Cut"

The cut clipboard command. Copies the current selection inside a WebKitWebView to the clipboard and deletes the selected content. You can check whether it's possible to execute the command with `webkit_web_view_can_execute_editing_command()`. In general it's possible to cut to the clipboard when the WebKitWebView content is editable and there is an active selection.

### WEBKIT_EDITING_COMMAND_COPY

    #define WEBKIT_EDITING_COMMAND_COPY "Copy"

The copy clipboard command. Copies the current selection inside a WebKitWebView to the clipboard. You can check whether it's possible to execute the command with `webkit_web_view_can_execute_editing_command()`. In general it's possible to copy to the clipboard when there is an active selection inside the WebKitWebView.

### WEBKIT_EDITING_COMMAND_PASTE

    #define WEBKIT_EDITING_COMMAND_PASTE "Paste"

The paste clipboard command. Pastes the contents of the clipboard to a WebKitWebView. You can check whether it's possible to execute the command with `webkit_web_view_can_execute_editing_command()`. In general it's possible to paste from the clipboard when the WebKitWebView content is editable and clipboard is not empty.

### WEBKIT_EDITING_COMMAND_SELECT_ALL

    #define WEBKIT_EDITING_COMMAND_SELECT_ALL "SelectAll"

The select all command. Selects all the content of the current text field in a WebKitWebView. It is always possible to select all text, no matter whether the WebKitWebView content is editable or not. You can still check it with `webkit_web_view_can_execute_editing_command()`.

### WEBKIT_EDITING_COMMAND_UNDO

    #define WEBKIT_EDITING_COMMAND_UNDO "Undo"

The undo command. Undoes the last editing command in a WebKitWebView. You can check whether it's possible to execute the command with `webkit_web_view_can_execute_editing_command()`. It's only possible to undo a command after a previously executed editing operation.

### WEBKIT_EDITING_COMMAND_REDO

    #define WEBKIT_EDITING_COMMAND_REDO "Redo"

The redo command. Redoes a previously undone editing command in a WebKitWebView. You can check whether it's possible to execute the command with `webkit_web_view_can_execute_editing_command()`. It's only possible to redo a command when it has been previously undone.

### webkit_web_view_new ()

    GtkWidget *         webkit_web_view_new                 (void);

Creates a new WebKitWebView with the default WebKitWebContext and the default WebKitWebViewGroup. See also `webkit_web_view_new_with_context()` and `webkit_web_view_new_with_group()`.

Returns : | The newly created WebKitWebView widget

### webkit_web_view_new_with_context ()

    GtkWidget *         webkit_web_view_new_with_context    (WebKitWebContext *context);

Creates a new WebKitWebView with the given WebKitWebContext and the default WebKitWebViewGroup. See also `webkit_web_view_new_with_group()`.

`context` : | the WebKitWebContext to be used by the WebKitWebView
Returns : | The newly created WebKitWebView widget

### webkit_web_view_new_with_group ()

    GtkWidget *         webkit_web_view_new_with_group      (WebKitWebViewGroup *group);

Creates a new WebKitWebView with the given WebKitWebViewGroup. The view will be part of `group` and it will be affected by the group properties like the settings.

`group` : | a WebKitWebViewGroup
Returns : | The newly created WebKitWebView widget

### webkit_web_view_get_context ()

    WebKitWebContext *  webkit_web_view_get_context         (WebKitWebView *web_view);

Gets the web context of `web_view`.

`web_view` : | a WebKitWebView
Returns : | the WebKitWebContext of the view. [transfer none]

### webkit_web_view_get_group ()

    WebKitWebViewGroup * webkit_web_view_get_group          (WebKitWebView *web_view);

Gets the group `web_view` belongs to.

`web_view` : | a WebKitWebView
Returns : | the WebKitWebViewGroup to which the view belongs. [transfer none]

### webkit_web_view_load_uri ()

    void                webkit_web_view_load_uri            (WebKitWebView *web_view,
                                                             const gchar *uri);

Requests loading of the specified URI string. You can monitor the load operation by connecting to "load-changed" signal.

`web_view` : | a WebKitWebView
`uri` : | an URI string

### webkit_web_view_load_html ()

    void                webkit_web_view_load_html           (WebKitWebView *web_view,
                                                             const gchar *content,
                                                             const gchar *base_uri);

Load the given `content` string with the specified `base_uri`. If `base_uri` is not `NULL`, relative URLs in the `content` will be resolved against `base_uri` and absolute local paths must be children of the `base_uri`. For security reasons absolute local paths that are not children of `base_uri` will cause the web process to terminate. If you need to include URLs in `content` that are local paths in a different directory than `base_uri` you can build a data URI for them. When `base_uri` is `NULL`, it defaults to "about:blank". The mime type of the document will be "text/html". You can monitor the load operation by connecting to "load-changed" signal.

`web_view` : | a WebKitWebView
`content` : | The HTML string to load
`base_uri` : | The base URI for relative locations or `NULL`. [allow-none]

### webkit_web_view_load_alternate_html ()

    void                webkit_web_view_load_alternate_html (WebKitWebView *web_view,
                                                             const gchar *content,
                                                             const gchar *content_uri,
                                                             const gchar *base_uri);

Load the given `content` string for the URI `content_uri`. This allows clients to display page-loading errors in the WebKitWebView itself. When this method is called from "load-failed" signal to show an error page, the the back-forward list is maintained appropriately. For everything else this method works the same way as `webkit_web_view_load_html()`.

`web_view` : | a WebKitWebView
`content` : | the new content to display as the main page of the `web_view`
`content_uri` : | the URI for the alternate page content
`base_uri` : | the base URI for relative locations or `NULL`. [allow-none]

### webkit_web_view_load_plain_text ()

    void                webkit_web_view_load_plain_text     (WebKitWebView *web_view,
                                                             const gchar *plain_text);

Load the specified `plain_text` string into `web_view`. The mime type of document will be "text/plain". You can monitor the load operation by connecting to "load-changed" signal.

`web_view` : | a WebKitWebView
`plain_text` : | The plain text to load

### webkit_web_view_load_request ()

    void                webkit_web_view_load_request        (WebKitWebView *web_view,
                                                             WebKitURIRequest *request);

Requests loading of the specified WebKitURIRequest. You can monitor the load operation by connecting to "load-changed" signal.

`web_view` : | a WebKitWebView
`request` : | a WebKitURIRequest to load

### webkit_web_view_can_go_back ()

    gboolean            webkit_web_view_can_go_back         (WebKitWebView *web_view);

Determines whether `web_view` has a previous history item.

`web_view` : | a WebKitWebView
Returns : | `TRUE` if able to move back or `FALSE` otherwise.

### webkit_web_view_go_back ()

    void                webkit_web_view_go_back             (WebKitWebView *web_view);

Loads the previous history item. You can monitor the load operation by connecting to "load-changed" signal.

`web_view` : | a WebKitWebView

### webkit_web_view_can_go_forward ()

    gboolean            webkit_web_view_can_go_forward      (WebKitWebView *web_view);

Determines whether `web_view` has a next history item.

`web_view` : | a WebKitWebView
Returns : | `TRUE` if able to move forward or `FALSE` otherwise.

### webkit_web_view_go_forward ()

    void                webkit_web_view_go_forward          (WebKitWebView *web_view);

Loads the next history item. You can monitor the load operation by connecting to "load-changed" signal.

`web_view` : | a WebKitWebView

### webkit_web_view_get_title ()

    const gchar *       webkit_web_view_get_title           (WebKitWebView *web_view);

Gets the value of the "title" property. You can connect to notify::title signal of `web_view` to be notified when the title has been received.

`web_view` : | a WebKitWebView
Returns : | The main frame document title of `web_view`.

### webkit_web_view_get_page_id ()

    guint64             webkit_web_view_get_page_id         (WebKitWebView *web_view);

Get the identifier of the WebKitWebPage corresponding to the WebKitWebView

`web_view` : | a WebKitWebView
Returns : | the page ID of `web_view`.

### webkit_web_view_reload ()

    void                webkit_web_view_reload              (WebKitWebView *web_view);

Reloads the current contents of `web_view`. See also `webkit_web_view_reload_bypass_cache()`.

`web_view` : | a WebKitWebView

### webkit_web_view_reload_bypass_cache ()

    void                webkit_web_view_reload_bypass_cache (WebKitWebView *web_view);

Reloads the current contents of `web_view` without using any cached data.

`web_view` : | a WebKitWebView

### webkit_web_view_stop_loading ()

    void                webkit_web_view_stop_loading        (WebKitWebView *web_view);

Stops any ongoing loading operation in `web_view`. This method does nothing if no content is being loaded. If there is a loading operation in progress, it will be cancelled and "load-failed" signal will be emitted with `WEBKIT_NETWORK_ERROR_CANCELLED` error.

`web_view` : | a WebKitWebView

### webkit_web_view_is_loading ()

    gboolean            webkit_web_view_is_loading          (WebKitWebView *web_view);

Gets the value of the "is-loading" property. You can monitor when a WebKitWebView is loading a page by connecting to notify::is-loading signal of `web_view`. This is useful when you are interesting in knowing when the view is loding something but not in the details about the status of the load operation, for example to start a spinner when the view is loading a page and stop it when it finishes.

`web_view` : | a WebKitWebView
Returns : | `TRUE` if `web_view` is loading a page or `FALSE` otherwise.

### webkit_web_view_get_estimated_load_progress ()

    gdouble             webkit_web_view_get_estimated_load_progress
                                                            (WebKitWebView *web_view);

Gets the value of the "estimated-load-progress" property. You can monitor the estimated progress of a load operation by connecting to the notify::estimated-load-progress signal of `web_view`.

`web_view` : | a WebKitWebView
Returns : | an estimate of the of the percent complete for a document load as a range from 0.0 to 1.0.

### webkit_web_view_get_custom_charset ()

    const gchar *       webkit_web_view_get_custom_charset  (WebKitWebView *web_view);

Returns the current custom character encoding name of `web_view`.

`web_view` : | a WebKitWebView
Returns : | the current custom character encoding name or `NULL` if no custom character encoding has been set.

### webkit_web_view_set_custom_charset ()

    void                webkit_web_view_set_custom_charset  (WebKitWebView *web_view,
                                                             const gchar *charset);

Sets the current custom character encoding override of `web_view`. The custom character encoding will override any text encoding detected via HTTP headers or META tags. Calling this method will stop any current load operation and reload the current page. Setting the custom character encoding to `NULL` removes the character encoding override.

`web_view` : | a WebKitWebView
`charset` : | a character encoding name or `NULL`. [allow-none]

### webkit_web_view_get_back_forward_list ()

    WebKitBackForwardList * webkit_web_view_get_back_forward_list
                                                            (WebKitWebView *web_view);

Obtains the WebKitBackForwardList associated with the given WebKitWebView. The WebKitBackForwardList is owned by the WebKitWebView.

`web_view` : | a WebKitWebView
Returns : | the WebKitBackForwardList. [transfer none]

### webkit_web_view_go_to_back_forward_list_item ()

    void                webkit_web_view_go_to_back_forward_list_item
                                                            (WebKitWebView *web_view,
                                                             WebKitBackForwardListItem *list_item);

Loads the specific history item `list_item`. You can monitor the load operation by connecting to "load-changed" signal.

`web_view` : | a WebKitWebView
`list_item` : | a WebKitBackForwardListItem

### webkit_web_view_get_uri ()

    const gchar *       webkit_web_view_get_uri             (WebKitWebView *web_view);

Returns the current active URI of `web_view`. The active URI might change during a load operation:

1. When nothing has been loaded yet on `web_view` the active URI is `NULL`.

2. When a new load operation starts the active URI is the requested URI:

   - If the load operation was started by `webkit_web_view_load_uri()`, the requested URI is the given one.

   - If the load operation was started by `webkit_web_view_load_html()`, the requested URI is "about:blank".

   - If the load operation was started by `webkit_web_view_load_alternate_html()`, the requested URI is content URI provided.

   - If the load operation was started by `webkit_web_view_go_back()` or `webkit_web_view_go_forward()`, the requested URI is the original URI of the previous/next item in the WebKitBackForwardList of `web_view`.

   - If the load operation was started by `webkit_web_view_go_to_back_forward_list_item()`, the requested URI is the opriginal URI of the given WebKitBackForwardListItem.

3. If there is a server redirection during the load operation, the active URI is the redirected URI. When the signal "load-changed" is emitted with `WEBKIT_LOAD_REDIRECTED` event, the active URI is already updated to the redirected URI.

4. When the signal "load-changed" is emitted with `WEBKIT_LOAD_COMMITTED` event, the active URI is the final one and it will not change unless a new load operation is started or a navigation action within the same page is performed.

You can monitor the active URI by connecting to the notify::uri signal of `web_view`.

`web_view` : | a WebKitWebView
Returns : | the current active URI of `web_view` or `NULL` if nothing has been loaded yet.

### webkit_web_view_get_favicon ()

    cairo_surface_t *   webkit_web_view_get_favicon         (WebKitWebView *web_view);

Returns favicon currently associated to `web_view`, if any. You can connect to notify::favicon signal of `web_view` to be notified when the favicon is available.

`web_view` : | a WebKitWebView
Returns : | a pointer to a cairo_surface_t with the favicon or `NULL` if there's no icon associated with `web_view`. [transfer none]

### webkit_web_view_set_settings ()

    void                webkit_web_view_set_settings        (WebKitWebView *web_view,
                                                             WebKitSettings *settings);

Sets the WebKitSettings to be applied to `web_view`. This is a convenient method to set new settings to the WebKitWebViewGroup `web_view` belongs to. New settings are applied immediately on all WebKitWebViews in the `web_view` group. See also `webkit_web_view_group_set_settings()`.

`web_view` : | a WebKitWebView
`settings` : | a WebKitSettings

### webkit_web_view_get_settings ()

    WebKitSettings *    webkit_web_view_get_settings        (WebKitWebView *web_view);

Gets the WebKitSettings currently applied to `web_view`. This is a convenient method to get the settings of the WebKitWebViewGroup `web_view` belongs to. WebKitSettings objects are shared by all the WebKitWebViews in the same WebKitWebViewGroup, so modifying the settings of a WebKitWebView would affect other WebKitWebViews of the same group. See also `webkit_web_view_group_get_settings()`.

`web_view` : | a WebKitWebView
Returns : | the WebKitSettings attached to `web_view`. [transfer none]

### webkit_web_view_get_window_properties ()

    WebKitWindowProperties * webkit_web_view_get_window_properties
                                                            (WebKitWebView *web_view);

Get the WebKitWindowProperties object containing the properties that the window containing `web_view` should have.

`web_view` : | a WebKitWebView
Returns : | the WebKitWindowProperties of `web_view`. [transfer none]

### webkit_web_view_set_zoom_level ()

    void                webkit_web_view_set_zoom_level      (WebKitWebView *web_view,
                                                             gdouble zoom_level);

Set the zoom level of `web_view`, i.e. the factor by which the view contents are scaled with respect to their original size.

`web_view` : | a WebKitWebView
`zoom_level` : | the zoom level

### webkit_web_view_get_zoom_level ()

    gdouble             webkit_web_view_get_zoom_level      (WebKitWebView *web_view);

Get the zoom level of `web_view`, i.e. the factor by which the view contents are scaled with respect to their original size.

`web_view` : | a WebKitWebView
Returns : | the current zoom level of `web_view`

### webkit_web_view_can_execute_editing_command ()

    void                webkit_web_view_can_execute_editing_command
                                                            (WebKitWebView *web_view,
                                                             const gchar *command,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously execute the given editing command.

When the operation is finished, `callback` will be called. You can then call `webkit_web_view_can_execute_editing_command_finish()` to get the result of the operation.

`web_view` : | a WebKitWebView
`command` : | the command to check
`cancellable` : | a GCancellable or `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied. [scope async]
`user_data` : | the data to pass to callback function. [closure]

### webkit_web_view_can_execute_editing_command_finish ()

    gboolean            webkit_web_view_can_execute_editing_command_finish
                                                            (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish an asynchronous operation started with `webkit_web_view_can_execute_editing_command()`.

`web_view` : | a WebKitWebView
`result` : | a GAsyncResult
`error` : | return location for error or `NULL` to ignore
Returns : | `TRUE` if the editing command can be executed or `FALSE` otherwise

### webkit_web_view_execute_editing_command ()

    void                webkit_web_view_execute_editing_command
                                                            (WebKitWebView *web_view,
                                                             const gchar *command);

Request to execute the given `command` for `web_view`. You can use `webkit_web_view_can_execute_editing_command()` to check whether it's possible to execute the command.

`web_view` : | a WebKitWebView
`command` : | the command to execute

### webkit_web_view_get_find_controller ()

    WebKitFindController * webkit_web_view_get_find_controller
                                                            (WebKitWebView *web_view);

Gets the WebKitFindController that will allow the caller to query the WebKitWebView for the text to look for.

`web_view` : | the WebKitWebView
Returns : | the WebKitFindController associated to this particular WebKitWebView. [transfer none]

### webkit_web_view_get_inspector ()

    WebKitWebInspector * webkit_web_view_get_inspector      (WebKitWebView *web_view);

Get the WebKitWebInspector associated to `web_view`

`web_view` : | a WebKitWebView
Returns : | the WebKitWebInspector of `web_view`. [transfer none]

### webkit_web_view_get_javascript_global_context ()

    JSGlobalContextRef  webkit_web_view_get_javascript_global_context
                                                            (WebKitWebView *web_view);

Get the global JavaScript context used by `web_view` to deserialize the result values of scripts executed with `webkit_web_view_run_javascript()`.

`web_view` : | a WebKitWebView
Returns : | the `JSGlobalContextRef` used by `web_view` to deserialize the result values of scripts.

### webkit_web_view_run_javascript ()

    void                webkit_web_view_run_javascript      (WebKitWebView *web_view,
                                                             const gchar *script,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously run `script` in the context of the current page in `web_view`. If WebKitWebSettings:enable-javascript is FALSE, this method will do nothing.

When the operation is finished, `callback` will be called. You can then call `webkit_web_view_run_javascript_finish()` to get the result of the operation.

`web_view` : | a WebKitWebView
`script` : | the script to run
`cancellable` : | a GCancellable or `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the script finished. [scope async]
`user_data` : | the data to pass to callback function. [closure]

### webkit_web_view_run_javascript_finish ()

    WebKitJavascriptResult * webkit_web_view_run_javascript_finish
                                                            (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish an asynchronous operation started with `webkit_web_view_run_javascript()`.

This is an example of using `webkit_web_view_run_javascript()` with a script returning a string:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47

    static void
    web_view_javascript_finished (GObject      *object,
                                  GAsyncResult *result,
                                  gpointer      user_data)
    {
        WebKitJavascriptResult *js_result;
        JSValueRef              value;
        JSGlobalContextRef      context;
        GError                 *error = NULL;

        js_result = webkit_web_view_run_javascript_finish (WEBKIT_WEB_VIEW (object), result, &error);
        if (!js_result) {
            g_warning ("Error running javascript: %s", error->message);
            g_error_free (error);
            return;
        }

        context = webkit_javascript_result_get_global_context (js_result);
        value = webkit_javascript_result_get_value (js_result);
        if (JSValueIsString (context, value)) {
            JSStringRef js_str_value;
            gchar      *str_value;
            gsize       str_length;

            js_str_value = JSValueToStringCopy (context, value, NULL);
            str_length = JSStringGetMaximumUTF8CStringSize (js_str_value);
            str_value = (gchar *)g_malloc (str_length);
            JSStringGetUTF8CString (js_str_value, str_value, str_length);
            JSStringRelease (js_str_value);
            g_print ("Script result: %s\n", str_value);
            g_free (str_value);
        } else {
            g_warning ("Error running javascript: unexpected return value");
        }
        webkit_javascript_result_unref (js_result);
    }

    static void
    web_view_get_link_url (WebKitWebView *web_view,
                           const gchar   *link_id)
    {
        gchar *script;

        script = g_strdup_printf ("window.document.getElementById('%s').href;", link_id);
        webkit_web_view_run_javascript (web_view, script, NULL, web_view_javascript_finished, NULL);
        g_free (script);
    }

`web_view` : | a WebKitWebView
`result` : | a GAsyncResult
`error` : | return location for error or `NULL` to ignore
Returns : | a WebKitJavascriptResult with the result of the last executed statement in `script` or `NULL` in case of error. [transfer full]

### webkit_web_view_run_javascript_from_gresource ()

    void                webkit_web_view_run_javascript_from_gresource
                                                            (WebKitWebView *web_view,
                                                             const gchar *resource,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously run the script from `resource` in the context of the current page in `web_view`.

When the operation is finished, `callback` will be called. You can then call `webkit_web_view_run_javascript_from_gresource_finish()` to get the result of the operation.

`web_view` : | a WebKitWebView
`resource` : | the location of the resource to load
`cancellable` : | a GCancellable or `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the script finished. [scope async]
`user_data` : | the data to pass to callback function. [closure]

### webkit_web_view_run_javascript_from_gresource_finish ()

    WebKitJavascriptResult * webkit_web_view_run_javascript_from_gresource_finish
                                                            (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish an asynchronous operation started with `webkit_web_view_run_javascript_from_gresource()`.

Check `webkit_web_view_run_javascript_finish()` for a usage example.

`web_view` : | a WebKitWebView
`result` : | a GAsyncResult
`error` : | return location for error or `NULL` to ignore
Returns : | a WebKitJavascriptResult with the result of the last executed statement in `script` or `NULL` in case of error. [transfer full]

### webkit_web_view_can_show_mime_type ()

    gboolean            webkit_web_view_can_show_mime_type  (WebKitWebView *web_view,
                                                             const gchar *mime_type);

Whether or not a MIME type can be displayed in `web_view`.

`web_view` : | a WebKitWebView
`mime_type` : | a MIME type
Returns : | `TRUE` if the MIME type `mime_type` can be displayed or `FALSE` otherwise

### webkit_web_view_save ()

    void                webkit_web_view_save                (WebKitWebView *web_view,
                                                             WebKitSaveMode save_mode,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously save the current web page associated to the WebKitWebView into a self-contained format using the mode specified in `save_mode`.

When the operation is finished, `callback` will be called. You can then call `webkit_web_view_save_finish()` to get the result of the operation.

`web_view` : | a WebKitWebView
`save_mode` : | the WebKitSaveMode specifying how the web page should be saved.
`cancellable` : | a GCancellable or `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied. [scope async]
`user_data` : | the data to pass to callback function. [closure]

### webkit_web_view_save_finish ()

    GInputStream *      webkit_web_view_save_finish         (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish an asynchronous operation started with `webkit_web_view_save()`.

`web_view` : | a WebKitWebView
`result` : | a GAsyncResult
`error` : | return location for error or `NULL` to ignore
Returns : | a GInputStream with the result of saving the current web page or `NULL` in case of error. [transfer full]

### webkit_web_view_save_to_file ()

    void                webkit_web_view_save_to_file        (WebKitWebView *web_view,
                                                             GFile *file,
                                                             WebKitSaveMode save_mode,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously save the current web page associated to the WebKitWebView into a self-contained format using the mode specified in `save_mode` and writing it to `file`.

When the operation is finished, `callback` will be called. You can then call `webkit_web_view_save_to_file_finish()` to get the result of the operation.

`web_view` : | a WebKitWebView
`file` : | the GFile where the current web page should be saved to.
`save_mode` : | the WebKitSaveMode specifying how the web page should be saved.
`cancellable` : | a GCancellable or `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied. [scope async]
`user_data` : | the data to pass to callback function. [closure]

### webkit_web_view_save_to_file_finish ()

    gboolean            webkit_web_view_save_to_file_finish (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish an asynchronous operation started with `webkit_web_view_save_to_file()`.

`web_view` : | a WebKitWebView
`result` : | a GAsyncResult
`error` : | return location for error or `NULL` to ignore
Returns : | `TRUE` if the web page was successfully saved to a file or `FALSE` otherwise.

### webkit_web_view_download_uri ()

    WebKitDownload *    webkit_web_view_download_uri        (WebKitWebView *web_view,
                                                             const char *uri);

Requests downloading of the specified URI string for `web_view`.

`web_view` : | a WebKitWebView
`uri` : | the URI to download
Returns : | a new WebKitDownload representing the the download operation. [transfer full]

### webkit_web_view_set_view_mode ()

    void                webkit_web_view_set_view_mode       (WebKitWebView *web_view,
                                                             WebKitViewMode view_mode);

Set the view mode of `web_view` to `view_mode`. This method should be called before loading new contents on `web_view` so that the new WebKitViewMode will be applied to the new contents.

`web_view` : | a WebKitWebView
`view_mode` : | a WebKitViewMode

### webkit_web_view_get_view_mode ()

    WebKitViewMode      webkit_web_view_get_view_mode       (WebKitWebView *web_view);

Get the view mode of `web_view`.

`web_view` : | a WebKitWebView
Returns : | the WebKitViewMode of `web_view`.

### webkit_web_view_get_tls_info ()

    gboolean            webkit_web_view_get_tls_info        (WebKitWebView *web_view,
                                                             GTlsCertificate **certificate,
                                                             GTlsCertificateFlags *errors);

Retrieves the GTlsCertificate associated with the `web_view` connection, and the GTlsCertificateFlags showing what problems, if any, have been found with that certificate. If the connection is not HTTPS, this function returns `FALSE`. This function should be called after a response has been received from the server, so you can connect to "load-changed" and call this function when it's emitted with `WEBKIT_LOAD_COMMITTED` event.

`web_view` : | a WebKitWebView
`certificate` : | return location for a GTlsCertificate. [out][transfer none]
`errors` : | return location for a GTlsCertificateFlags the verification status of `certificate`. [out]
Returns : | `TRUE` if the `web_view` connection uses HTTPS and a response has been received from the server, or `FALSE` otherwise.

### webkit_web_view_get_snapshot ()

    void                webkit_web_view_get_snapshot        (WebKitWebView *web_view,
                                                             WebKitSnapshotRegion region,
                                                             WebKitSnapshotOptions options,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously retrieves a snapshot of `web_view` for `region`. `options` specifies how the snapshot should be rendered.

When the operation is finished, `callback` will be called. You must call `webkit_web_view_get_snapshot_finish()` to get the result of the operation.

`web_view` : | a WebKitWebView
`region` : | the WebKitSnapshotRegion for this snapshot
`options` : | WebKitSnapshotOptions for the snapshot
`cancellable` : | a GCancellable. [allow-none]
`callback` : | a GAsyncReadyCallback. [scope async]
`user_data` : | user data. [closure]

### webkit_web_view_get_snapshot_finish ()

    cairo_surface_t *   webkit_web_view_get_snapshot_finish (WebKitWebView *web_view,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an asynchronous operation started with `webkit_web_view_get_snapshot()`.

`web_view` : | a WebKitWebView
`result` : | a GAsyncResult
`error` : | return location for error or `NULL` to ignore
Returns : | a cairo_surface_t with the retrieved snapshot or `NULL` in error. [transfer full]

### WebKitJavascriptResult

    typedef struct _WebKitJavascriptResult WebKitJavascriptResult;

### webkit_javascript_result_ref ()

    WebKitJavascriptResult * webkit_javascript_result_ref   (WebKitJavascriptResult *js_result);

Atomically increments the reference count of `js_result` by one. This function is MT-safe and may be called from any thread.

`js_result` : | a WebKitJavascriptResult
Returns : | The passed in WebKitJavascriptResult

### webkit_javascript_result_unref ()

    void                webkit_javascript_result_unref      (WebKitJavascriptResult *js_result);

Atomically decrements the reference count of `js_result` by one. If the reference count drops to 0, all memory allocated by the WebKitJavascriptResult is released. This function is MT-safe and may be called from any thread.

`js_result` : | a WebKitJavascriptResult

### webkit_javascript_result_get_global_context ()

    JSGlobalContextRef  webkit_javascript_result_get_global_context
                                                            (WebKitJavascriptResult *js_result);

Get the global Javascript context that should be used with the `JSValueRef` returned by `webkit_javascript_result_get_value()`.

`js_result` : | a WebKitJavascriptResult
Returns : | the `JSGlobalContextRef` for the WebKitJavascriptResult

### webkit_javascript_result_get_value ()

    JSValueRef          webkit_javascript_result_get_value  (WebKitJavascriptResult *js_result);

Get the value of `js_result`. You should use the `JSGlobalContextRef` returned by `webkit_javascript_result_get_global_context()` to use the `JSValueRef`.

`js_result` : | a WebKitJavascriptResult
Returns : | the `JSValueRef` of the WebKitJavascriptResult

### WebKitScriptDialog

    typedef struct _WebKitScriptDialog WebKitScriptDialog;

### enum WebKitScriptDialogType

    typedef enum {
        WEBKIT_SCRIPT_DIALOG_ALERT,
        WEBKIT_SCRIPT_DIALOG_CONFIRM,
        WEBKIT_SCRIPT_DIALOG_PROMPT
    } WebKitScriptDialogType;

Enum values used for determining the type of WebKitScriptDialog

`WEBKIT_SCRIPT_DIALOG_ALERT` | Alert script dialog, used to show a message to the user.
`WEBKIT_SCRIPT_DIALOG_CONFIRM` | Confirm script dialog, used to ask confirmation to the user.
`WEBKIT_SCRIPT_DIALOG_PROMPT` | Prompt script dialog, used to ask information to the user.

### webkit_script_dialog_get_dialog_type ()

    WebKitScriptDialogType webkit_script_dialog_get_dialog_type
                                                            (WebKitScriptDialog *dialog);

Get the dialog type of a WebKitScriptDialog.

`dialog` : | a WebKitScriptDialog
Returns : | the WebKitScriptDialogType of `dialog`

### webkit_script_dialog_get_message ()

    const gchar *       webkit_script_dialog_get_message    (WebKitScriptDialog *dialog);

Get the message of a WebKitScriptDialog.

`dialog` : | a WebKitScriptDialog
Returns : | the message of `dialog`.

### webkit_script_dialog_confirm_set_confirmed ()

    void                webkit_script_dialog_confirm_set_confirmed
                                                            (WebKitScriptDialog *dialog,
                                                             gboolean confirmed);

This method is used for `WEBKIT_SCRIPT_DIALOG_CONFIRM` dialogs when "script-dialog" signal is emitted to set whether the user confirmed the dialog or not. The default implementation of "script-dialog" signal sets `TRUE` when the OK button is clicked and `FALSE` otherwise. It's an error to use this method with a WebKitScriptDialog that is not of type `WEBKIT_SCRIPT_DIALOG_CONFIRM`.

`dialog` : | a WebKitScriptDialog
`confirmed` : | whether user confirmed the dialog

### webkit_script_dialog_prompt_get_default_text ()

    const gchar *       webkit_script_dialog_prompt_get_default_text
                                                            (WebKitScriptDialog *dialog);

Get the default text of a WebKitScriptDialog of type `WEBKIT_SCRIPT_DIALOG_PROMPT`. It's an error to use this method with a WebKitScriptDialog that is not of type `WEBKIT_SCRIPT_DIALOG_PROMPT`.

`dialog` : | a WebKitScriptDialog
Returns : | the default text of `dialog`

### webkit_script_dialog_prompt_set_text ()

    void                webkit_script_dialog_prompt_set_text
                                                            (WebKitScriptDialog *dialog,
                                                             const gchar *text);

This method is used for `WEBKIT_SCRIPT_DIALOG_PROMPT` dialogs when "script-dialog" signal is emitted to set the text entered by the user. The default implementation of "script-dialog" signal sets the text of the entry form when OK button is clicked, otherwise `NULL` is set. It's an error to use this method with a WebKitScriptDialog that is not of type `WEBKIT_SCRIPT_DIALOG_PROMPT`.

`dialog` : | a WebKitScriptDialog
`text` : | the text to set

### webkit_web_view_get_main_resource ()

    WebKitWebResource * webkit_web_view_get_main_resource   (WebKitWebView *web_view);

Return the main resource of `web_view`.

`web_view` : | a WebKitWebView
Returns : | the main WebKitWebResource of the view or `NULL` if nothing has been loaded. [transfer none]

## Property Details

### The `"estimated-load-progress"` property

      "estimated-load-progress"  gdouble               : Read

An estimate of the percent completion for the current loading operation. This value will range from 0.0 to 1.0 and, once a load completes, will remain at 1.0 until a new load starts, at which point it will be reset to 0.0. The value is an estimate based on the total number of bytes expected to be received for a document, including all its possible subresources and child documents.

Allowed values: [0,1]

Default value: 0

### The `"favicon"` property

      "favicon"                  gpointer              : Read

The favicon currently associated to the WebKitWebView. See `webkit_web_view_get_favicon()` for more details.

### The `"group"` property

      "group"                    WebKitWebViewGroup*   : Read / Write / Construct Only

The WebKitWebViewGroup of the view.

### The `"is-loading"` property

      "is-loading"               gboolean              : Read

Whether the WebKitWebView is currently loading a page. This property becomes `TRUE` as soon as a new load operation is requested and before the "load-changed" signal is emitted with `WEBKIT_LOAD_STARTED` and at that point the active URI is the requested one. When the load operation finishes the property is set to `FALSE` before "load-changed" is emitted with `WEBKIT_LOAD_FINISHED`.

Default value: FALSE

### The `"title"` property

      "title"                    gchar*                : Read

The main frame document title of this WebKitWebView. If the title has not been received yet, it will be `NULL`.

Default value: NULL

### The `"uri"` property

      "uri"                      gchar*                : Read

The current active URI of the WebKitWebView. See `webkit_web_view_get_uri()` for more details.

Default value: NULL

### The `"view-mode"` property

      "view-mode"                WebKitViewMode        : Read / Write

The WebKitViewMode that is used to display the contents of a WebKitWebView. See also `webkit_web_view_set_view_mode()`.

Default value: WEBKIT_VIEW_MODE_WEB

### The `"web-context"` property

      "web-context"              WebKitWebContext*     : Read / Write / Construct Only

The WebKitWebContext of the view.

### The `"zoom-level"` property

      "zoom-level"               gdouble               : Read / Write

The zoom level of the WebKitWebView content. See `webkit_web_view_set_zoom_level()` for more details.

Allowed values: >= 0

Default value: 1

## Signal Details

### The `"authenticate"` signal

    gboolean            user_function                      (WebKitWebView               *web_view,
                                                            WebKitAuthenticationRequest *request,
                                                            gpointer                     user_data)      : Run Last

This signal is emitted when the user is challenged with HTTP authentication. To let the application access or supply the credentials as well as to allow the client application to either cancel the request or perform the authentication, the signal will pass an instance of the WebKitAuthenticationRequest in the `request` argument. To handle this signal asynchronously you should keep a ref of the request and return `TRUE`. To disable HTTP authentication entirely, connect to this signal and simply return `TRUE`.

The default signal handler will run a default authentication dialog asynchronously for the user to interact with.

`web_view` : | the WebKitWebView on which the signal is emitted
`request` : | a WebKitAuthenticationRequest
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

Since 2.2

### The `"close"` signal

    void                user_function                      (WebKitWebView *webView,
                                                            gpointer       user_data)      : Run Last

Emitted when closing a WebKitWebView is requested. This occurs when a call is made from JavaScript's `window.close` function. It is the owner's responsibility to handle this signal to hide or destroy the WebKitWebView, if necessary.

`webView` : | the WebKitWebView on which the signal is emitted
`user_data` : | user data set when the signal handler was connected.

### The `"context-menu"` signal

    gboolean            user_function                      (WebKitWebView       *web_view,
                                                            WebKitContextMenu   *context_menu,
                                                            GdkEvent            *event,
                                                            WebKitHitTestResult *hit_test_result,
                                                            gpointer             user_data)            : Run Last

Emmited when a context menu is about to be displayed to give the application a chance to customize the proposed menu, prevent the menu from being displayed or build its own context menu.

- To customize the proposed menu you can use `webkit_context_menu_prepend()`, `webkit_context_menu_append()` or `webkit_context_menu_insert()` to add new WebKitContextMenuItems to `context_menu`, `webkit_context_menu_move_item()` to reorder existing items, or `webkit_context_menu_remove()` to remove an existing item. The signal handler should return `FALSE`, and the menu represented by `context_menu` will be shown.

- To prevent the menu from being displayed you can just connect to this signal and return `TRUE` so that the proposed menu will not be shown.

- To build your own menu, you can remove all items from the proposed menu with `webkit_context_menu_remove_all()`, add your own items and return `FALSE` so that the menu will be shown. You can also ignore the proposed WebKitContextMenu, build your own GtkMenu and return `TRUE` to prevent the proposed menu from being shown.

- If you just want the default menu to be shown always, simply don't connect to this signal because showing the proposed context menu is the default behaviour.

If the signal handler returns `FALSE` the context menu represented by `context_menu` will be shown, if it return `TRUE` the context menu will not be shown.

The proposed WebKitContextMenu passed in `context_menu` argument is only valid during the signal emission.

`web_view` : | the WebKitWebView on which the signal is emitted
`context_menu` : | the proposed WebKitContextMenu
`event` : | the GdkEvent that triggered the context menu
`hit_test_result` : | a WebKitHitTestResult
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

### The `"context-menu-dismissed"` signal

    void                user_function                      (WebKitWebView *web_view,
                                                            gpointer       user_data)      : Run Last

Emitted after "context-menu" signal, if the context menu is shown, to notify that the context menu is dismissed.

`web_view` : | the WebKitWebView on which the signal is emitted
`user_data` : | user data set when the signal handler was connected.

### The `"create"` signal

    GtkWidget*          user_function                      (WebKitWebView *web_view,
                                                            gpointer       user_data)      : Run Last

Emitted when the creation of a new WebKitWebView is requested. If this signal is handled the signal handler should return the newly created WebKitWebView.

The new WebKitWebView should not be displayed to the user until the "ready-to-show" signal is emitted.

`web_view` : | the WebKitWebView on which the signal is emitted
`user_data` : | user data set when the signal handler was connected.
Returns : | a newly allocated WebKitWebView widget or `NULL` to propagate the event further. [transfer full]

### The `"decide-policy"` signal

    gboolean            user_function                      (WebKitWebView           *web_view,
                                                            WebKitPolicyDecision    *decision,
                                                            WebKitPolicyDecisionType decision_type,
                                                            gpointer                 user_data)          : Run Last

This signal is emitted when WebKit is requesting the client to decide a policy decision, such as whether to navigate to a page, open a new window or whether or not to download a resource. The WebKitNavigationPolicyDecision passed in the `decision` argument is a generic type, but should be casted to a more specific type when making the decision. For example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24

    static gboolean
    decide_policy_cb (WebKitWebView *web_view,
                      WebKitPolicyDecision *decision,
                      WebKitPolicyDecisionType type)
    {
        switch (type) {
        case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
            WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
            /* Make a policy decision here. */
            break;
        case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
            WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
            /* Make a policy decision here. */
            break;
        case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
            WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision);
            /* Make a policy decision here. */
            break;
        default:
            /* Making no decision results in webkit_policy_decision_use(). */
            return FALSE;
        }
        return TRUE;
    }

It is possible to make policy decision asynchronously, by simply calling `g_object_ref()` on the `decision` argument and returning `TRUE` to block the default signal handler. If the last reference is removed on a WebKitPolicyDecision and no decision has been made explicitly, `webkit_policy_decision_use()` will be the default policy decision. The default signal handler will simply call `webkit_policy_decision_use()`. Only the first policy decision chosen for a given WebKitPolicyDecision will have any affect.

`web_view` : | the WebKitWebView on which the signal is emitted
`decision` : | the WebKitPolicyDecision
`decision_type` : | a WebKitPolicyDecisionType denoting the type of `decision`
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

### The `"enter-fullscreen"` signal

    gboolean            user_function                      (WebKitWebView *web_view,
                                                            gpointer       user_data)      : Run Last

Emitted when JavaScript code calls `element.webkitRequestFullScreen`. If the signal is not handled the WebKitWebView will proceed to full screen its top level window. This signal can be used by client code to request permission to the user prior doing the full screen transition and eventually prepare the top-level window (e.g. hide some widgets that would otherwise be part of the full screen window).

`web_view` : | the WebKitWebView on which the signal is emitted.
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to continue emission of the event.

### The `"insecure-content-detected"` signal

    void                user_function                      (WebKitWebView             *web_view,
                                                            WebKitInsecureContentEvent event,
                                                            gpointer                   user_data)      : Run Last

This signal is emitted when insecure content has been detected in a page loaded through a secure connection. This typically means that a external resource from an unstrusted source has been run or displayed, resulting in a mix of HTTPS and non-HTTPS content.

You can check the `event` parameter to know exactly which kind of event has been detected (see WebKitInsecureContentEvent).

`web_view` : | the WebKitWebView on which the signal is emitted
`event` : | the WebKitInsecureContentEvent
`user_data` : | user data set when the signal handler was connected.

### The `"leave-fullscreen"` signal

    gboolean            user_function                      (WebKitWebView *web_view,
                                                            gpointer       user_data)      : Run Last

Emitted when the WebKitWebView is about to restore its top level window out of its full screen state. This signal can be used by client code to restore widgets hidden during the "enter-fullscreen" stage for instance.

`web_view` : | the WebKitWebView on which the signal is emitted.
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to continue emission of the event.

### The `"load-changed"` signal

    void                user_function                      (WebKitWebView  *web_view,
                                                            WebKitLoadEvent load_event,
                                                            gpointer        user_data)       : Run Last

Emitted when the a load operation in `web_view` changes. The signal is always emitted with `WEBKIT_LOAD_STARTED` when a new load request is made and `WEBKIT_LOAD_FINISHED` when the load finishes successfully or due to an error. When the ongoing load operation fails "load-failed" signal is emitted before "load-changed" is emitted with `WEBKIT_LOAD_FINISHED`. If a redirection is received from the server, this signal is emitted with `WEBKIT_LOAD_REDIRECTED` after the initial emission with `WEBKIT_LOAD_STARTED` and before `WEBKIT_LOAD_COMMITTED`. When the page content starts arriving the signal is emitted with `WEBKIT_LOAD_COMMITTED` event.

You can handle this signal and use a switch to track any ongoing load operation.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26

    static void web_view_load_changed (WebKitWebView  *web_view,
                                       WebKitLoadEvent load_event,
                                       gpointer        user_data)
    {
        switch (load_event) {
        case WEBKIT_LOAD_STARTED:
            /* New load, we have now a provisional URI */
            provisional_uri = webkit_web_view_get_uri (web_view);
            /* Here we could start a spinner or update the
             * location bar with the provisional URI */
            break;
        case WEBKIT_LOAD_REDIRECTED:
            redirected_uri = webkit_web_view_get_uri (web_view);
            break;
        case WEBKIT_LOAD_COMMITTED:
            /* The load is being performed. Current URI is
             * the final one and it won't change unless a new
             * load is requested or a navigation within the
             * same page is performed */
            uri = webkit_web_view_get_uri (web_view);
            break;
        case WEBKIT_LOAD_FINISHED:
            /* Load finished, we can now stop the spinner */
            break;
        }
    }

`web_view` : | the WebKitWebView on which the signal is emitted
`load_event` : | the WebKitLoadEvent
`user_data` : | user data set when the signal handler was connected.

### The `"load-failed"` signal

    gboolean            user_function                      (WebKitWebView  *web_view,
                                                            WebKitLoadEvent load_event,
                                                            gchar          *failing_uri,
                                                            gpointer        error,
                                                            gpointer        user_data)        : Run Last

Emitted when an error occurs during a load operation. If the error happened when starting to load data for a page `load_event` will be `WEBKIT_LOAD_STARTED`. If it happened while loading a committed data source `load_event` will be `WEBKIT_LOAD_COMMITTED`. Since a load error causes the load operation to finish, the signal WebKitWebView::load-changed will always be emitted with `WEBKIT_LOAD_FINISHED` event right after this one.

By default, if the signal is not handled, a stock error page will be displayed. You need to handle the signal if you want to provide your own error page.

`web_view` : | the WebKitWebView on which the signal is emitted
`load_event` : | the WebKitLoadEvent of the load operation
`failing_uri` : | the URI that failed to load
`error` : | the GError that was triggered
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

### The `"mouse-target-changed"` signal

    void                user_function                      (WebKitWebView       *web_view,
                                                            WebKitHitTestResult *hit_test_result,
                                                            guint                modifiers,
                                                            gpointer             user_data)            : Run Last

This signal is emitted when the mouse cursor moves over an element such as a link, image or a media element. To determine what type of element the mouse cursor is over, a Hit Test is performed on the current mouse coordinates and the result is passed in the `hit_test_result` argument. The `modifiers` argument is a bitmask of GdkModifierType flags indicating the state of modifier keys. The signal is emitted again when the mouse is moved out of the current element with a new `hit_test_result`.

`web_view` : | the WebKitWebView on which the signal is emitted
`hit_test_result` : | a WebKitHitTestResult
`modifiers` : | a bitmask of GdkModifierType
`user_data` : | user data set when the signal handler was connected.

### The `"permission-request"` signal

    gboolean            user_function                      (WebKitWebView           *web_view,
                                                            WebKitPermissionRequest *request,
                                                            gpointer                 user_data)      : Run Last

This signal is emitted when WebKit is requesting the client to decide about a permission request, such as allowing the browser to switch to fullscreen mode, sharing its location or similar operations.

A possible way to use this signal could be through a dialog allowing the user decide what to do with the request:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24

    static gboolean permission_request_cb (WebKitWebView *web_view,
                                           WebKitPermissionRequest *request,
                                           GtkWindow *parent_window)
    {
        GtkWidget *dialog = gtk_message_dialog_new (parent_window,
                                                    GTK_DIALOG_MODAL,
                                                    GTK_MESSAGE_QUESTION,
                                                    GTK_BUTTONS_YES_NO,
                                                    "Allow Permission Request?");
        gtk_widget_show (dialog);
        gint result = gtk_dialog_run (GTK_DIALOG (dialog));

        switch (result) {
        case GTK_RESPONSE_YES:
            webkit_permission_request_allow (request);
            break;
        default:
            webkit_permission_request_deny (request);
            break;
        }
        gtk_widget_destroy (dialog);

        return TRUE;
    }

It is possible to handle permission requests asynchronously, by simply calling `g_object_ref()` on the `request` argument and returning `TRUE` to block the default signal handler. If the last reference is removed on a WebKitPermissionRequest and the request has not been handled, `webkit_permission_request_deny()` will be the default action.

By default, if the signal is not handled, `webkit_permission_request_deny()` will be called over the WebKitPermissionRequest.

`web_view` : | the WebKitWebView on which the signal is emitted
`request` : | the WebKitPermissionRequest
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

### The `"print"` signal

    gboolean            user_function                      (WebKitWebView        *web_view,
                                                            WebKitPrintOperation *print_operation,
                                                            gpointer              user_data)            : Run Last

Emitted when printing is requested on `web_view`, usually by a javascript call, before the print dialog is shown. This signal can be used to set the initial print settings and page setup of `print_operation` to be used as default values in the print dialog. You can call `webkit_print_operation_set_print_settings()` and `webkit_print_operation_set_page_setup()` and then return `FALSE` to propagate the event so that the print dialog is shown.

You can connect to this signal and return `TRUE` to cancel the print operation or implement your own print dialog.

`web_view` : | the WebKitWebView on which the signal is emitted
`print_operation` : | the WebKitPrintOperation that will handle the print request
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

### The `"ready-to-show"` signal

    void                user_function                      (WebKitWebView *web_view,
                                                            gpointer       user_data)      : Run Last

Emitted after "create" on the newly created WebKitWebView when it should be displayed to the user. When this signal is emitted all the information about how the window should look, including size, position, whether the location, status and scrollbars should be displayed, is already set on the WebKitWindowProperties of `web_view`. See also `webkit_web_view_get_window_properties()`.

`web_view` : | the WebKitWebView on which the signal is emitted
`user_data` : | user data set when the signal handler was connected.

### The `"resource-load-started"` signal

    void                user_function                      (WebKitWebView     *web_view,
                                                            WebKitWebResource *resource,
                                                            WebKitURIRequest  *request,
                                                            gpointer           user_data)      : Run Last

Emitted when a new resource is going to be loaded. The `request` parameter contains the WebKitURIRequest that will be sent to the server. You can monitor the load operation by connecting to the different signals of `resource`.

`web_view` : | the WebKitWebView on which the signal is emitted
`resource` : | a WebKitWebResource
`request` : | a WebKitURIRequest
`user_data` : | user data set when the signal handler was connected.

### The `"run-as-modal"` signal

    void                user_function                      (WebKitWebView *web_view,
                                                            gpointer       user_data)      : Run Last

Emitted after "ready-to-show" on the newly created WebKitWebView when JavaScript code calls `window.showModalDialog`. The purpose of this signal is to allow the client application to prepare the new view to behave as modal. Once the signal is emitted a new mainloop will be run to block user interaction in the parent WebKitWebView until the new dialog is closed.

`web_view` : | the WebKitWebView on which the signal is emitted
`user_data` : | user data set when the signal handler was connected.

### The `"run-file-chooser"` signal

    gboolean            user_function                      (WebKitWebView            *web_view,
                                                            WebKitFileChooserRequest *request,
                                                            gpointer                  user_data)      : Run Last

This signal is emitted when the user interacts with a <input type='file' /> HTML element, requesting from WebKit to show a dialog to select one or more files to be uploaded. To let the application know the details of the file chooser, as well as to allow the client application to either cancel the request or perform an actual selection of files, the signal will pass an instance of the WebKitFileChooserRequest in the `request` argument.

The default signal handler will asynchronously run a regular GtkFileChooserDialog for the user to interact with.

`web_view` : | the WebKitWebView on which the signal is emitted
`request` : | a WebKitFileChooserRequest
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

### The `"script-dialog"` signal

    gboolean            user_function                      (WebKitWebView      *web_view,
                                                            WebKitScriptDialog *dialog,
                                                            gpointer            user_data)      : Run Last

Emitted when JavaScript code calls `window.alert`, `window.confirm` or `window.prompt`. The `dialog` parameter should be used to build the dialog. If the signal is not handled a different dialog will be built and shown depending on the dialog type:

- `WEBKIT_SCRIPT_DIALOG_ALERT`: message dialog with a single Close button.

- `WEBKIT_SCRIPT_DIALOG_CONFIRM`: message dialog with OK and Cancel buttons.

- `WEBKIT_SCRIPT_DIALOG_PROMPT`: message dialog with OK and Cancel buttons and a text entry with the default text.

`web_view` : | the WebKitWebView on which the signal is emitted
`dialog` : | the WebKitScriptDialog to show
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.

### The `"submit-form"` signal

    void                user_function                      (WebKitWebView               *web_view,
                                                            WebKitFormSubmissionRequest *request,
                                                            gpointer                     user_data)      : Run Last

This signal is emitted when a form is about to be submitted. The `request` argument passed contains information about the text fields of the form. This is typically used to store login information that can be used later to pre-fill the form. The form will not be submitted until `webkit_form_submission_request_submit()` is called.

It is possible to handle the form submission request asynchronously, by simply calling `g_object_ref()` on the `request` argument and calling `webkit_form_submission_request_submit()` when done to continue with the form submission. If the last reference is removed on a WebKitFormSubmissionRequest and the form has not been submitted, `webkit_form_submission_request_submit()` will be called.

`web_view` : | the WebKitWebView on which the signal is emitted
`request` : | a WebKitFormSubmissionRequest
`user_data` : | user data set when the signal handler was connected.

### The `"web-process-crashed"` signal

    gboolean            user_function                      (WebKitWebView *web_view,
                                                            gpointer       user_data)      : Run Last

This signal is emitted when the web process crashes.

`web_view` : | the WebKitWebView
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` to stop other handlers from being invoked for the event. `FALSE` to propagate the event further.