![]() |
![]() |
![]() |
WebKit2GTK+ Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
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
);
GObject +----GInitiallyUnowned +----GtkWidget +----GtkContainer +----WebKitWebViewBase +----WebKitWebView
"estimated-load-progress" gdouble : Read "title" gchar* : Read "uri" gchar* : Read "web-context" WebKitWebContext* : Read / Write / Construct Only
"close" :Run Last
"create" :Run Last
"ready-to-show" :Run Last
"script-alert" :Run Last
"script-confirm" :Run Last
"script-prompt" :Run Last
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 |
GtkWidget * webkit_web_view_new_with_context (WebKitWebContext *context
);
Creates a new WebKitWebView with the given WebKitWebContext.
|
the WebKitWebContext to be used by the WebKitWebView |
Returns : |
The newly created WebKitWebView widget |
WebKitWebContext * webkit_web_view_get_context (WebKitWebView *web_view
);
Gets the web context of web_view
.
|
a WebKitWebView |
Returns : |
the WebKitWebContext of the view. [transfer none] |
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
.
|
a WebKitWebView |
Returns : |
the WebKitWebLoaderClient of web_view . [transfer none]
|
void webkit_web_view_set_loader_client (WebKitWebView *web_view
,WebKitWebLoaderClient *loader_client
);
Sets the WebKitWebLoaderClient that the view will use during load operations.
|
a WebKitWebView |
|
a WebKitWebLoaderClient |
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()
.
|
a WebKitWebView |
|
an URI string |
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()
.
|
a WebKitWebView |
|
The HTML string to load |
|
The base URI for relative locations or NULL . [allow-none]
|
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()
.
|
a WebKitWebView |
|
The plain text to load |
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()
.
|
a WebKitWebView |
|
the alternate content to display as the main page of the web_view
|
|
the base URI for relative locations |
|
the URI for the alternate page content |
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()
.
|
a WebKitWebView |
|
a WebKitURIRequest to load |
gboolean webkit_web_view_can_go_back (WebKitWebView *web_view
);
Determines whether web_view
has a previous history item.
|
a WebKitWebView |
Returns : |
TRUE if able to move back or FALSE otherwise. |
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()
.
|
a WebKitWebView |
gboolean webkit_web_view_can_go_forward (WebKitWebView *web_view
);
Determines whether web_view
has a next history item.
|
a WebKitWebView |
Returns : |
TRUE if able to move forward or FALSE otherwise. |
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()
.
|
a WebKitWebView |
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.
|
a WebKitWebView |
Returns : |
The main frame document title of web_view . |
void webkit_web_view_reload (WebKitWebView *web_view
);
Reloads the current contents of web_view
.
See also webkit_web_view_reload_bypass_cache()
.
|
a WebKitWebView |
void webkit_web_view_reload_bypass_cache (WebKitWebView *web_view
);
Reloads the current contents of web_view
without
using any cached data.
|
a WebKitWebView |
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()
.
|
a WebKitWebView |
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
.
|
a WebKitWebView |
Returns : |
an estimate of the of the percent complete for a document load as a range from 0.0 to 1.0. |
const gchar * webkit_web_view_get_custom_charset (WebKitWebView *web_view
);
Returns the current custom character encoding name of web_view
.
|
a WebKitWebView |
Returns : |
the current custom character encoding name or NULL if no
custom character encoding has been set. |
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.
|
a WebKitWebView |
|
a character encoding name or NULL . [allow-none]
|
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.
|
a WebKitWebView |
Returns : |
the WebKitBackForwardList. [transfer none] |
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()
.
|
a WebKitWebView |
|
a WebKitBackForwardListItem |
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:
When nothing has been loaded yet on web_view
the active URI is NULL
.
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_alternate_html()
,
the requested URI is "about:blank".
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.
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.
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
.
|
a WebKitWebView |
Returns : |
the current active URI of web_view or NULL
if nothing has been loaded yet. |
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.
|
a WebKitWebView |
|
a WebKitSettings |
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.
|
a WebKitWebView |
Returns : |
the WebKitSettings attached to web_view . [transfer none]
|
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.
|
a WebKitWebView |
Returns : |
the WebKitWindowProperties of web_view . [transfer none]
|
"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
"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
"uri"
property "uri" gchar* : Read
The current active URI of the WebKitWebView.
See webkit_web_view_get_uri()
for more details.
Default value: NULL
"web-context"
property"web-context" WebKitWebContext* : Read / Write / Construct Only
The WebKitWebContext of the view.
"close"
signalvoid 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.
|
the WebKitWebView on which the signal is emitted |
|
user data set when the signal handler was connected. |
"create"
signalGtkWidget* 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.
|
the WebKitWebView on which the signal is emitted |
|
user data set when the signal handler was connected. |
Returns : |
a newly allocated WebKitWebView widget
or NULL to propagate the event further. [transfer full]
|
"ready-to-show"
signalvoid 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()
.
|
the WebKitWebView on which the signal is emitted |
|
user data set when the signal handler was connected. |
"script-alert"
signalgboolean 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.
|
the WebKitWebView on which the signal is emitted |
|
the message text |
|
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. |
"script-confirm"
signalgboolean 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
.
|
the WebKitWebView on which the signal is emitted |
|
the message text |
|
return location for confirm dialog response. [out] |
|
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. |
"script-prompt"
signalgboolean 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
.
|
the WebKitWebView on which the signal is emitted |
|
the message text
default (allow-none): the default text |
|
return location for prompt dialog text response. [out] |
|
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. |