WebKitWebPage: WebKitGTK Reference Manual

## WebKitWebPage WebKitWebPage |

## Functions

WebKitDOMDocument * | webkit_web_page_get_dom_document ()
guint64 | webkit_web_page_get_id ()
const gchar * | webkit_web_page_get_uri ()
WebKitFrame * | webkit_web_page_get_main_frame ()
WebKitWebEditor * | webkit_web_page_get_editor ()

## Properties

gchar * | uri | Read

## Signals

void | console-message-sent | Run Last
gboolean | context-menu | Run Last
void | document-loaded | Run Last
void | form-controls-associated | Run Last
void | form-controls-associated-for-frame | Run Last
gboolean | send-request | Run Last
void | will-submit-form | Run Last

## Types and Values

| WebKitWebPage
enum | WebKitFormSubmissionStep

## Object Hierarchy

        GEnum
        ╰── WebKitFormSubmissionStep
        GObject
        ╰── WebKitWebPage

## Description

## Functions

### webkit_web_page_get_dom_document ()

    WebKitDOMDocument *
    webkit_web_page_get_dom_document (WebKitWebPage *web_page);

Get the WebKitDOMDocument currently loaded in `web_page`

#### Parameters

web_page | a WebKitWebPage |

#### Returns

the WebKitDOMDocument currently loaded, or `NULL` if no document is currently loaded.

[transfer none]

### webkit_web_page_get_id ()

    guint64
    webkit_web_page_get_id (WebKitWebPage *web_page);

Get the identifier of the WebKitWebPage

#### Parameters

web_page | a WebKitWebPage |

#### Returns

the identifier of `web_page`

### webkit_web_page_get_uri ()

    const gchar *
    webkit_web_page_get_uri (WebKitWebPage *web_page);

Returns the current active URI of `web_page` .

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

#### Parameters

web_page | a WebKitWebPage |

#### Returns

the current active URI of `web_view` or `NULL` if nothing has been loaded yet.

### webkit_web_page_get_main_frame ()

    WebKitFrame *
    webkit_web_page_get_main_frame (WebKitWebPage *web_page);

Returns the main frame of a WebKitWebPage.

#### Parameters

web_page | a WebKitWebPage |

#### Returns

the WebKitFrame that is the main frame of `web_page` .

[transfer none]

Since: 2.2

### webkit_web_page_get_editor ()

    WebKitWebEditor *
    webkit_web_page_get_editor (WebKitWebPage *web_page);

Gets the WebKitWebEditor of a WebKitWebPage.

#### Parameters

web_page | a WebKitWebPage |

#### Returns

the WebKitWebEditor.

[transfer none]

Since: 2.10

## Types and Values

### WebKitWebPage

    typedef struct _WebKitWebPage WebKitWebPage;

### enum WebKitFormSubmissionStep

Used to indicate a particular stage in form submission. See “will-submit-form”.

#### Members

WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT | indicates the form's DOM submit event is about to be emitted. |
WEBKIT_FORM_SUBMISSION_WILL_COMPLETE | indicates the form is about to be submitted. |

Since: 2.20

## Property Details

### The `“uri”` property

      “uri”                      gchar *

The current active URI of the WebKitWebPage.

Owner: WebKitWebPage

Flags: Read

Default value: NULL

## Signal Details

### The `“console-message-sent”` signal

    void
    user_function (WebKitWebPage        *web_page,
                   WebKitConsoleMessage *console_message,
                   gpointer              user_data)

Emitted when a message is sent to the console. This can be a message produced by the use of JavaScript console API, a JavaScript exception, a security error or other errors, warnings, debug or log messages. The `console_message` contains information of the message.

#### Parameters

web_page | the WebKitWebPage on which the signal is emitted |
console_message | the WebKitConsoleMessage |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.12

### The `“context-menu”` signal

    gboolean
    user_function (WebKitWebPage          *web_page,
                   WebKitContextMenu      *context_menu,
                   WebKitWebHitTestResult *hit_test_result,
                   gpointer                user_data)

Emitted before a context menu is displayed in the UI Process to give the application a chance to customize the proposed menu, build its own context menu or pass user data to the UI Process. This signal is useful when the information available in the UI Process is not enough to build or customize the context menu, for example, to add menu entries depending on the WebKitDOMNode at the coordinates of the `hit_test_result` . Otherwise, it's recommended to use “context-menu” signal instead.

#### Parameters

web_page | the WebKitWebPage on which the signal is emitted |
context_menu | the proposed WebKitContextMenu |
hit_test_result | a WebKitWebHitTestResult |
user_data | user data set when the signal handler was connected. |

#### Returns

`TRUE` if the proposed `context_menu` has been modified, or `FALSE` otherwise.

Flags: Run Last

Since: 2.8

### The `“document-loaded”` signal

    void
    user_function (WebKitWebPage *web_page,
                   gpointer       user_data)

This signal is emitted when the DOM document of a WebKitWebPage has been loaded.

You can wait for this signal to get the DOM document with `webkit_web_page_get_dom_document()`.

#### Parameters

web_page | the WebKitWebPage on which the signal is emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“form-controls-associated”` signal

    void
    user_function (WebKitWebPage *web_page,
                   GPtrArray     *elements,
                   gpointer       user_data)

Emitted after form elements (or form associated elements) are associated to a particular web page. This is useful to implement form auto filling for web pages where form fields are added dynamically. This signal might be emitted multiple times for the same web page.

Note that this signal could be also emitted when form controls are moved between forms. In that case, the `elements` array carries the list of those elements which have moved.

Clients should take a reference to the members of the `elements` array if it is desired to keep them alive after the signal handler returns.

`WebKitWebPage::form-controls-associated` has been deprecated since version 2.26 and should not be used in newly-written code.

, use “form-controls-associated-for-frame” instead.

#### Parameters

web_page | the WebKitWebPage on which the signal is emitted |
elements | a GPtrArray of WebKitDOMElement with the list of forms in the page. | [element-type WebKitDOMElement][transfer none]
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.16

### The `“form-controls-associated-for-frame”` signal

    void
    user_function (WebKitWebPage *web_page,
                   GPtrArray     *elements,
                   WebKitFrame   *frame,
                   gpointer       user_data)

Emitted after form elements (or form associated elements) are associated to a particular web page. This is useful to implement form auto filling for web pages where form fields are added dynamically. This signal might be emitted multiple times for the same web page.

Note that this signal could be also emitted when form controls are moved between forms. In that case, the `elements` array carries the list of those elements which have moved.

Clients should take a reference to the members of the `elements` array if it is desired to keep them alive after the signal handler returns.

#### Parameters

web_page | the WebKitWebPage on which the signal is emitted |
elements | a GPtrArray of WebKitDOMElement with the list of forms in the page. | [element-type WebKitDOMElement][transfer none]
frame | the WebKitFrame |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.26

### The `“send-request”` signal

    gboolean
    user_function (WebKitWebPage     *web_page,
                   WebKitURIRequest  *request,
                   WebKitURIResponse *redirected_response,
                   gpointer           user_data)

This signal is emitted when `request` is about to be sent to the server. This signal can be used to modify the WebKitURIRequest that will be sent to the server. You can also cancel the resource load operation by connecting to this signal and returning `TRUE`.

In case of a server redirection this signal is emitted again with the `request` argument containing the new request to be sent to the server due to the redirection and the `redirected_response` parameter containing the response received by the server for the initial request.

Modifications to the WebKitURIRequest and its associated SoupMessageHeaders will be taken into account when the request is sent over the network.

#### Parameters

web_page | the WebKitWebPage on which the signal is emitted |
request | a WebKitURIRequest |
redirected_response | a WebKitURIResponse, or `NULL` |
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.

Flags: Run Last

### The `“will-submit-form”` signal

    void
    user_function (WebKitWebPage           *web_page,
                   WebKitDOMElement        *form,
                   WebKitFormSubmissionStep step,
                   WebKitFrame             *source_frame,
                   WebKitFrame             *target_frame,
                   GPtrArray               *text_field_names,
                   GPtrArray               *text_field_values,
                   gpointer                 user_data)

This signal is emitted to indicate various points during form submission. `step` indicates the current stage of form submission.

If this signal is emitted with `WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT`, then the DOM submit event is about to be emitted. JavaScript code may rely on the submit event to detect that the user has clicked on a submit button, and to possibly cancel the form submission before `WEBKIT_FORM_SUBMISSION_WILL_COMPLETE`. However, beware that, for historical reasons, the submit event is not emitted at all if the form submission is triggered by JavaScript. For these reasons, `WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT` may not be used to reliably detect whether a form will be submitted. Instead, use it to detect if a user has clicked on a form's submit button even if JavaScript later cancels the form submission, or to read the values of the form's fields even if JavaScript later clears certain fields before submitting. This may be needed, for example, to implement a robust browser password manager, as some misguided websites may use such techniques to attempt to thwart password managers.

If this signal is emitted with `WEBKIT_FORM_SUBMISSION_WILL_COMPLETE`, the form will imminently be submitted. It can no longer be cancelled. This event always occurs immediately before a form is submitted to its target, so use this event to reliably detect when a form is submitted. This event occurs after `WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT` if that event is emitted.

#### Parameters

web_page | the WebKitWebPage on which the signal is emitted |
form | the WebKitDOMElement to be submitted, which will always correspond to an HTMLFormElement |
step | a WebKitFormSubmissionEventType indicating the current stage of form submission |
source_frame | the WebKitFrame containing the form to be submitted |
target_frame | the WebKitFrame containing the form's target, which may be the same as `source_frame` if no target was specified |
text_field_names | names of the form's text fields. | [element-type utf8][transfer none]
text_field_values | values of the form's text fields. | [element-type utf8][transfer none]
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.20