WebKitWebView

WebKitWebView

Synopsis

                    WebKitWebView;
enum                WebKitLoadEvent;
enum                WebKitPolicyDecisionType;

#define             WEBKIT_EDITING_COMMAND_CUT
#define             WEBKIT_EDITING_COMMAND_COPY
#define             WEBKIT_EDITING_COMMAND_PASTE

GtkWidget *         webkit_web_view_new                 (void);
GtkWidget *         webkit_web_view_new_with_context    (WebKitWebContext *context);
WebKitWebContext *  webkit_web_view_get_context         (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_plain_text     (WebKitWebView *web_view,
                                                         const gchar *plain_text);
void                webkit_web_view_load_request        (WebKitWebView *web_view,
                                                         WebKitURIRequest *request);
void                webkit_web_view_replace_content     (WebKitWebView *web_view,
                                                         const gchar *content,
                                                         const gchar *content_uri,
                                                         const gchar *base_uri);
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);
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);
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);
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,
                                                         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);

Object Hierarchy

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

Implemented Interfaces

WebKitWebView implements AtkImplementorIface and GtkBuildable.

Properties

  "estimated-load-progress"  gdouble               : Read
  "title"                    gchar*                : Read
  "uri"                      gchar*                : Read
  "web-context"              WebKitWebContext*     : Read / Write / Construct Only
  "zoom-level"               gdouble               : Read / Write

Signals

  "close"                                          : Run Last
  "create"                                         : Run Last
  "decide-policy"                                  : Run Last
  "load-changed"                                   : Run Last
  "load-failed"                                    : Run Last
  "mouse-target-changed"                           : Run Last
  "print-requested"                                : Run Last
  "ready-to-show"                                  : Run Last
  "script-alert"                                   : Run Last
  "script-confirm"                                 : Run Last
  "script-prompt"                                  : Run Last

Description

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.

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

GtkWidget *         webkit_web_view_new                 (void);

Creates a new WebKitWebView with the default WebKitWebContext. See also webkit_web_view_new_with_context().

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.

context :

the WebKitWebContext to be used by the WebKitWebView

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_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_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_replace_content ()

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

Replace the content of web_view with content using content_uri as page URI. This allows clients to display page-loading errors in the WebKitWebView itself. This is typically called from "load-failed" signal. The URI passed in base_uri has to be an absolute URI. The mime type of the document will be "text/html". Signals "load-changed" and "load-failed" are not emitted when replacing content of a WebKitWebView using this method.

web_view :

a WebKitWebView

content :

the new content to display as the main page of the web_view

content_uri :

the URI for the page content

base_uri :

the base URI for relative locations or NULL. [allow-none]

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_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_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:

  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.

  5. When the page content is replaced using webkit_web_view_replace_content(), the active URI is the content_uri provided.

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

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

Sets the WebKitSettings to be applied to web_view. The existing WebKitSettings of web_view will be replaced by settings. New settings are applied immediately on web_view. The same WebKitSettings object can be shared by multiple WebKitWebViews.

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. If no other WebKitSettings have been explicitly applied to web_view with webkit_web_view_set_settings(), the default WebKitSettings will be returned. This method always returns a valid WebKitSettings object. To modify any of the web_view settings, you can either create a new WebKitSettings object with webkit_settings_new(), setting the desired preferences, and then replace the existing web_view settings with webkit_web_view_set_settings() or get the existing web_view settings and update it directly. WebKitSettings objects can be shared by multiple WebKitWebViews, so modifying the settings of a WebKitWebView would affect other WebKitWebViews using the same WebKitSettings.

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,
                                                         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

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 a selection can be cut 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]

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 "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 "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 "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 "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:

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

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.

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 "print-requested" 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 "script-alert" signal

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

Emitted when JavaScript code calls window.alert. If the signal is not handled a message dialog with a single Close button will be shown with the message text.

web_view :

the WebKitWebView on which the signal is emitted

message :

the message text

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-confirm" signal

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

Emitted when JavaScript code calls confirm. If the signal is not handled a message dialog with OK and Cancel buttons will be shown with the message text. If OK button is clicked confirmed will be set to TRUE, otherwise it will be FALSE.

web_view :

the WebKitWebView on which the signal is emitted

message :

the message text

confirmed :

return location for confirm dialog response. [out]

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-prompt" signal

gboolean            user_function                      (WebKitWebView *web_view,
                                                        gchar         *message,
                                                        gchar         *text,
                                                        gpointer       Returns,
                                                        gpointer       user_data)      : Run Last

Emitted when JavaScript code calls prompt. If the signal is not handled a message dialog with OK and Cancel buttons and a text entry will be shown with the message text. If OK button is clicked text will contain the text entered by the user, otherwise it will be NULL.

web_view :

the WebKitWebView on which the signal is emitted

message :

the message text default (allow-none): the default text

text :

return location for prompt dialog text response. [out]

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.