WebKitWebView

WebKitWebView

Synopsis

                    WebKitWebView;
GtkWidget *         webkit_web_view_new                 (void);
GtkWidget *         webkit_web_view_new_with_context    (WebKitWebContext *context);
WebKitWebContext *  webkit_web_view_get_context         (WebKitWebView *web_view);
WebKitWebLoaderClient * webkit_web_view_get_loader_client
                                                        (WebKitWebView *web_view);
void                webkit_web_view_set_loader_client   (WebKitWebView *web_view,
                                                         WebKitWebLoaderClient *loader_client);
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_alternate_html (WebKitWebView *web_view,
                                                         const gchar *content,
                                                         const gchar *base_uri,
                                                         const gchar *unreachable_uri);
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);
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);

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

Signals

  "close"                                          : Run Last
  "create"                                         : 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;


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

WebKitWebLoaderClient * webkit_web_view_get_loader_client
                                                        (WebKitWebView *web_view);

Returns the WebKitWebLoaderClient of web_view. You can use it to monitor the status of load operations happening on web_view.

web_view :

a WebKitWebView

Returns :

the WebKitWebLoaderClient of web_view. [transfer none]

webkit_web_view_set_loader_client ()

void                webkit_web_view_set_loader_client   (WebKitWebView *web_view,
                                                         WebKitWebLoaderClient *loader_client);

Sets the WebKitWebLoaderClient that the view will use during load operations.

web_view :

a WebKitWebView

loader_client :

a WebKitWebLoaderClient

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 status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

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. Relative URLs in the content will be resolved against base_uri. When base_uri is NULL, it defaults to "about:blank". The mime type of the document will be "text/html". You can monitor the status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

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 status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

web_view :

a WebKitWebView

plain_text :

The plain text to load

webkit_web_view_load_alternate_html ()

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

Request loading of an alternate content for a URI that is unreachable. This allows clients to display page-loading errors in the WebKitWebView itself. This is typically called from "provisional-load-failed" or "load-failed" signals. When called from those signals this method will preserve the back-forward list. The URI passed in base_uri has to be an absolute URI. You can monitor the status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

web_view :

a WebKitWebView

content :

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

base_uri :

the base URI for relative locations

unreachable_uri :

the URI for the alternate page content

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 status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

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 status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

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 status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

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 "provisional-load-failed" or "load-failed" will be emitted on the current WebKitWebLoaderClient with WEBKIT_NETWORK_ERROR_CANCELLED error. See also webkit_web_view_get_loader_client().

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 status of the load operation using the WebKitWebLoaderClient of web_view. See webkit_web_view_get_loader_client().

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 "provisional-load-received-server-redirect" is emitted, the active URI is already updated to the redirected URI.

  4. When the signal "load-committed" is emitted, 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_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]

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.

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