The central class of the WPE WebKit and WebKitGTK APIs.
WebView is the central class of the WPE WebKit and WebKitGTK APIs. It is responsible for managing the drawing
of the content and forwarding of events. You can load any URI into the WebView or a data string. With
Settings you can control various aspects of the rendering and loading of the content.
Note that in WebKitGTK, WebView is scrollable by itself, so you don't need to embed it in a
ScrolledWindow.
- public async bool can_execute_editing_command (string command, Cancellable? cancellable = null) throws Error
Asynchronously check if it is possible to execute the given editing
command.
- public bool can_go_back ()
Determines whether this has a
previous history item.
- public bool can_go_forward ()
Determines whether this has a next
history item.
- public bool can_show_mime_type (string mime_type)
Whether or not a MIME type can be displayed in
this.
- public Download download_uri (string uri)
Requests downloading of the specified URI string for
this.
- public void execute_editing_command (string command)
Request to execute the given command
for
this.
- public void execute_editing_command_with_argument (string command, string argument)
Request to execute the given command
with argument
for this.
- public AutomationBrowsingContextPresentation get_automation_presentation_type ()
Get the presentation type of WebView when
created for automation.
- public unowned BackForwardList get_back_forward_list ()
- public RGBA get_background_color ()
Gets the color that is used to draw the
this background.
- public MediaCaptureState get_camera_capture_state ()
Get the camera capture state of a WebView.
- public unowned WebContext get_context ()
Gets the web context of this.
- public unowned string get_custom_charset ()
Returns the current custom character encoding name of
this.
- public unowned string? get_default_content_security_policy ()
Gets the configured default Content-Security-Policy.
- public MediaCaptureState get_display_capture_state ()
Get the display capture state of a WebView.
- public unowned EditorState get_editor_state ()
Gets the web editor state of this.
- public double get_estimated_load_progress ()
- public unowned Surface get_favicon ()
Returns favicon currently associated to
this.
- public unowned FindController get_find_controller ()
- public unowned InputMethodContext? get_input_method_context ()
- public unowned WebInspector get_inspector ()
- public bool get_is_muted ()
Gets the mute state of this.
- public bool get_is_web_process_responsive ()
Get whether the current web process of a WebView
is responsive.
- public unowned GlobalContext get_javascript_global_context ()
Get the global JavaScript context.
- public unowned WebResource get_main_resource ()
Return the main resource of this.
- public MediaCaptureState get_microphone_capture_state ()
Get the microphone capture state of a WebView
.
- public uint64 get_page_id ()
Get the identifier of the WebKitWebPage
corresponding to
the WebView
- public WebViewSessionState get_session_state ()
Gets the current session state of this
- public unowned Settings get_settings ()
Gets the Settings
currently applied to this.
- public async Surface get_snapshot (SnapshotRegion region, SnapshotOptions options, Cancellable? cancellable = null) throws Error
Asynchronously retrieves a snapshot of this
for region
.
- public unowned string get_title ()
Gets the value of the
title property.
- public bool get_tls_info (out unowned TlsCertificate certificate, out TlsCertificateFlags errors)
Retrieves the TlsCertificate associated
with the main resource of this.
- public unowned string get_uri ()
Returns the current active URI of this
.
- public unowned UserContentManager get_user_content_manager ()
Gets the user content manager associated to
this.
- public WebExtensionMode get_web_extension_mode ()
- public unowned WebsiteDataManager get_website_data_manager ()
- public unowned WebsitePolicies get_website_policies ()
Gets the default website policies.
- public unowned WindowProperties get_window_properties ()
- public double get_zoom_level ()
Set the zoom level of this.
- public void go_back ()
Loads the previous history item.
- public void go_forward ()
Loads the next history item.
- public void go_to_back_forward_list_item (BackForwardListItem list_item)
Loads the specific history item list_item
.
- public bool is_editable ()
Gets whether the user is allowed to edit the HTML document.
- public void load_alternate_html (string content, string content_uri, string? base_uri)
Load the given content
string for the URI
content_uri
.
- public void load_bytes (Bytes bytes, string? mime_type, string? encoding, string? base_uri)
Load the specified bytes
into
this using the given mime_type
and encoding
.
- public void load_html (string content, string? base_uri)
Load the given content
string with the specified
base_uri
.
- public void load_plain_text (string plain_text)
Load the specified plain_text
string into
this.
- public void load_request (URIRequest request)
- public void load_uri (string uri)
Requests loading of the specified URI string.
- public void reload ()
Reloads the current contents of this
.
- public void reload_bypass_cache ()
Reloads the current contents of this
without using any cached data.
- public void restore_session_state (WebViewSessionState state)
Restore the this session state from
state
- public async void run_async_javascript_function_in_world (string body, Variant arguments, string world_name, Cancellable? cancellable = null)
- public async JavascriptResult run_javascript (string script, Cancellable? cancellable = null) throws Error
Asynchronously run script
in the context of the current
page in this.
- public async JavascriptResult run_javascript_from_gresource (string resource, Cancellable? cancellable = null) throws Error
Asynchronously run the script from resource
.
- public async JavascriptResult run_javascript_in_world (string script, string world_name, Cancellable? cancellable = null) throws Error
Asynchronously run script
in the script world.
- public async InputStream save (SaveMode save_mode, Cancellable? cancellable = null) throws Error
Asynchronously save the current web page.
- public async bool save_to_file (File file, SaveMode save_mode, Cancellable? cancellable = null) throws Error
Asynchronously save the current web page.
- public async UserMessage send_message_to_page (UserMessage message, Cancellable? cancellable = null) throws Error
Send message
to the WebKitWebPage
corresponding to this.
- public void set_background_color (RGBA rgba)
Sets the color that will be used to draw the
this background.
- public void set_camera_capture_state (MediaCaptureState state)
Set the camera capture state of a WebView.
- public void set_cors_allowlist (string[]? allowlist)
Sets the allowlist
for CORS.
- public void set_custom_charset (string? charset)
Sets the current custom character encoding override of
this.
- public void set_display_capture_state (MediaCaptureState state)
Set the display capture state of a WebView.
- public void set_editable (bool editable)
Sets whether the user is allowed to edit the HTML document.
- public void set_input_method_context (InputMethodContext? context)
- public void set_is_muted (bool muted)
Sets the mute state of this.
- public void set_microphone_capture_state (MediaCaptureState state)
Set the microphone capture state of a WebView
.
- public void set_settings (Settings settings)
Sets the Settings to
be applied to this.
- public void set_zoom_level (double zoom_level)
Set the zoom level of this.
- public virtual bool show_option_menu (Rectangle rectangle, OptionMenu menu)
- public void stop_loading ()
Stops any ongoing loading operation in this
.
- public void terminate_web_process ()
Terminates the web process associated to
this.
- public void try_close ()
Tries to close the this.
- public virtual signal bool authenticate (AuthenticationRequest request)
This signal is emitted when the user is challenged with HTTP
authentication.
- public virtual signal void close ()
Emitted when closing a WebView is
requested.
- public virtual signal bool context_menu (ContextMenu context_menu, Event event, HitTestResult hit_test_result)
Emitted 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.
- public virtual signal void context_menu_dismissed ()
Emitted after
context_menu signal, if the context menu is shown, to notify that the
context menu is dismissed.
- public signal Widget create (NavigationAction navigation_action)
Emitted when the creation of a new WebView
is requested.
- public virtual signal bool decide_policy (PolicyDecision decision, PolicyDecisionType type)
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.
- public virtual signal bool enter_fullscreen ()
Emitted when JavaScript code calls <function>element.
- public virtual signal void insecure_content_detected (InsecureContentEvent event)
This signal is emitted when insecure content has been detected in a
page loaded through a secure connection.
- public virtual signal bool leave_fullscreen ()
Emitted when the WebView is about to
restore its top level window out of its full screen state.
- public virtual signal void load_changed (LoadEvent load_event)
Emitted when a load operation in web_view
changes.
- public virtual signal bool load_failed (LoadEvent load_event, string failing_uri, Error error)
Emitted when an error occurs during a load operation.
- public virtual signal bool load_failed_with_tls_errors (string failing_uri, TlsCertificate certificate, TlsCertificateFlags errors)
Emitted when a TLS error occurs during a load operation.
- public virtual signal void mouse_target_changed (HitTestResult hit_test_result, uint modifiers)
This signal is emitted when the mouse cursor moves over an element
such as a link, image or a media element.
- public signal bool on_show_option_menu (OptionMenu menu, Event event, Rectangle rectangle)
This signal is emitted when a select element in web_view
needs to display a dropdown menu.
- public virtual signal bool permission_request (PermissionRequest permission_request)
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.
- public virtual signal bool print (PrintOperation print_operation)
Emitted when printing is requested on web_view
, usually
by a JavaScript call, before the print dialog is shown.
- public virtual signal void ready_to_show ()
Emitted after
create on the newly created WebView when it should be displayed to the user.
- public virtual signal void resource_load_started (WebResource resource, URIRequest request)
Emitted when a new resource is going to be loaded.
- public virtual signal void run_as_modal ()
Emitted after
ready_to_show on the newly created WebView
when JavaScript code calls <function>window.
- public virtual signal bool run_color_chooser (ColorChooserRequest request)
This signal is emitted when the user interacts with a <input
type='color' /> HTML element, requesting from WebKit to show a dialog to select a color.
- public virtual signal bool run_file_chooser (FileChooserRequest request)
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.
- public virtual signal bool script_dialog (ScriptDialog dialog)
Emitted when JavaScript code calls <function>window.
- public virtual signal bool show_notification (Notification notification)
This signal is emitted when a notification should be presented to the
user.
- public virtual signal void submit_form (FormSubmissionRequest request)
This signal is emitted when a form is about to be submitted.
- public virtual signal bool user_message_received (UserMessage message)
This signal is emitted when a
UserMessage is received from the WebKitWebPage
corresponding to
web_view
.
- public virtual signal bool web_process_crashed ()
This signal is emitted when the web process crashes.
- public virtual signal void web_process_terminated (WebProcessTerminationReason reason)
This signal is emitted when the web process terminates abnormally due
to reason
.