Skip to main content

Type Alias: WebKitWebViewProps

WebKitWebViewProps = Omit<WebKitWebViewBaseProps, "onNotify"> & object

Defined in: generated/jsx.ts:11365

Props for the WebKitWebView widget.

Type Declaration

NameTypeDescriptionDefined in
cameraCaptureState?WebKit.MediaCaptureStateCapture state of the camera device. Whenever the user grants a media-request sent by the web page, requesting video capture capabilities (navigator.mediaDevices.getUserMedia({video: true})) this property will be set to %WEBKIT_MEDIA_CAPTURE_STATE_ACTIVE. The application can monitor this property and provide a visual indicator allowing to optionally deactivate or mute the capture device by setting this property respectively to %WEBKIT_MEDIA_CAPTURE_STATE_NONE or %WEBKIT_MEDIA_CAPTURE_STATE_MUTED. If the capture state of the device is set to %WEBKIT_MEDIA_CAPTURE_STATE_NONE the web-page can still re-request the permission to the user. Permission desision caching is left to the application.generated/jsx.ts:11379
children?ReactNode-generated/jsx.ts:11891
displayCaptureState?WebKit.MediaCaptureStateCapture state of the display device. Whenever the user grants a media-request sent by the web page, requesting screencasting capabilities (`navigator.mediaDevices.getDisplayMedia() this property will be set to %WEBKIT_MEDIA_CAPTURE_STATE_ACTIVE. The application can monitor this property and provide a visual indicator allowing to optionally deactivate or mute the capture device by setting this property respectively to %WEBKIT_MEDIA_CAPTURE_STATE_NONE or %WEBKIT_MEDIA_CAPTURE_STATE_MUTED. If the capture state of the device is set to %WEBKIT_MEDIA_CAPTURE_STATE_NONE the web-page can still re-request the permission to the user. Permission desision caching is left to the application.generated/jsx.ts:11393
editable?booleanWhether the pages loaded inside #WebKitWebView are editable. For more information see webkit_web_view_set_editable().generated/jsx.ts:11398
isMuted?booleanWhether the #WebKitWebView audio is muted. When %TRUE, audio is silenced. It may still be playing, i.e. #WebKitWebView:is-playing-audio may be %TRUE.generated/jsx.ts:11403
microphoneCaptureState?WebKit.MediaCaptureStateCapture state of the microphone device. Whenever the user grants a media-request sent by the web page, requesting audio capture capabilities (navigator.mediaDevices.getUserMedia({audio: true})) this property will be set to %WEBKIT_MEDIA_CAPTURE_STATE_ACTIVE. The application can monitor this property and provide a visual indicator allowing to optionally deactivate or mute the capture device by setting this property respectively to %WEBKIT_MEDIA_CAPTURE_STATE_NONE or %WEBKIT_MEDIA_CAPTURE_STATE_MUTED. If the capture state of the device is set to %WEBKIT_MEDIA_CAPTURE_STATE_NONE the web-page can still re-request the permission to the user. Permission desision caching is left to the application.generated/jsx.ts:11417
onAuthenticate()?(self, request) => boolean | nullThis signal is emitted when the user is challenged with HTTP authentication. To let the application access or supply the credentials as well as to allow the client application to either cancel the request or perform the authentication, the signal will pass an instance of the #WebKitAuthenticationRequest in the request argument. To handle this signal asynchronously you should keep a ref of the request and return %TRUE. To disable HTTP authentication entirely, connect to this signal and simply return %TRUE. The default signal handler will run a default authentication dialog asynchronously for the user to interact with.generated/jsx.ts:11439
onClose()?(self) => void | nullEmitted when closing a #WebKitWebView is requested. This occurs when a call is made from JavaScript's window.close function or after trying to close the web_view with webkit_web_view_try_close(). It is the owner's responsibility to handle this signal to hide or destroy the #WebKitWebView, if necessary.generated/jsx.ts:11447
onContextMenu()?(self, contextMenu, hitTestResult) => boolean | nullEmitted 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. To customize the proposed menu you can use webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert() to add new #WebKitContextMenuItems to context_menu, webkit_context_menu_move_item() to reorder existing items, or webkit_context_menu_remove() to remove an existing item. The signal handler should return %FALSE, and the menu represented by context_menu will be shown. To prevent the menu from being displayed you can just connect to this signal and return %TRUE so that the proposed menu will not be shown. To build your own menu, you can remove all items from the proposed menu with webkit_context_menu_remove_all(), add your own items and return %FALSE so that the menu will be shown. You can also ignore the proposed #WebKitContextMenu, build your own #GtkMenu and return %TRUE to prevent the proposed menu from being shown. If you just want the default menu to be shown always, simply don't connect to this signal because showing the proposed context menu is the default behaviour. If the signal handler returns %FALSE the context menu represented by context_menu will be shown, if it return %TRUE the context menu will not be shown. The proposed #WebKitContextMenu passed in context_menu argument is only valid during the signal emission.generated/jsx.ts:11483
onContextMenuDismissed()?(self) => void | nullEmitted after #WebKitWebView::context-menu signal, if the context menu is shown, to notify that the context menu is dismissed.generated/jsx.ts:11492
onCreate()?(self, navigationAction) => Gtk.Widget | nullEmitted when the creation of a new #WebKitWebView is requested. If this signal is handled the signal handler should return the newly created #WebKitWebView. The #WebKitNavigationAction parameter contains information about the navigation action that triggered this signal. The new #WebKitWebView must be related to web_view, see #WebKitWebView:related-view for more details. The new #WebKitWebView should not be displayed to the user until the #WebKitWebView::ready-to-show signal is emitted. For creating views as response to automation tools requests, see the #WebKitAutomationSession::create-web-view signal.generated/jsx.ts:11510
onDecidePolicy()?(self, decision, decisionType) => boolean | nullThis 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.generated/jsx.ts:11554
onEnterFullscreen()?(self) => boolean | nullEmitted when JavaScript code calls element.webkitRequestFullScreen. If the signal is not handled the #WebKitWebView will proceed to full screen its top level window. This signal can be used by client code to request permission to the user prior doing the full screen transition and eventually prepare the top-level window (e.g. hide some widgets that would otherwise be part of the full screen window).generated/jsx.ts:11569
onInsecureContentDetected()?(self, event) => void | nullPrior to 2.46, this signal was emitted when insecure content was loaded in a secure content. Since 2.46, this signal is generally no longer emitted.generated/jsx.ts:11575
onLeaveFullscreen()?(self) => boolean | nullEmitted when the #WebKitWebView is about to restore its top level window out of its full screen state. This signal can be used by client code to restore widgets hidden during the #WebKitWebView::enter-fullscreen stage for instance.generated/jsx.ts:11582
onLoadChanged()?(self, loadEvent) => void | nullEmitted when 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 #WebKitWebView::load-failed signal is emitted before #WebKitWebView::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; } }generated/jsx.ts:11629
onLoadFailed()?(self, loadEvent, failingUri, error) => boolean | nullEmitted 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.generated/jsx.ts:11642
onLoadFailedWithTlsErrors()?(self, failingUri, certificate, errors) => boolean | nullEmitted when a TLS error occurs during a load operation. To allow an exception for this certificate and the host of failing_uri use webkit_web_context_allow_tls_certificate_for_host(). To handle this signal asynchronously you should call g_object_ref() on certificate and return %TRUE. If %FALSE is returned, #WebKitWebView::load-failed will be emitted. The load will finish regardless of the returned value.generated/jsx.ts:11659
onMouseTargetChanged()?(self, hitTestResult, modifiers) => void | nullThis 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.generated/jsx.ts:11675
onNotify?(self, propName) => void | nullCalled when any property on this widget changes. Param The widget that emitted the notification Param The name of the property that changed (in kebab-case)generated/jsx.ts:11897
onPermissionRequest()?(self, request) => boolean | nullThis 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. A possible way to use this signal could be through a dialog allowing the user decide what to do with the request: static gboolean permission_request_cb (WebKitWebView *web_view, WebKitPermissionRequest *request, GtkWindow *parent_window) { GtkWidget *dialog = gtk_message_dialog_new (parent_window, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Allow Permission Request?"); gtk_widget_show (dialog); gint result = gtk_dialog_run (GTK_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_YES: webkit_permission_request_allow (request); break; default: webkit_permission_request_deny (request); break; } gtk_widget_destroy (dialog); return TRUE; } It is possible to handle permission requests asynchronously, by simply calling g_object_ref() on the request argument and returning %TRUE to block the default signal handler. If the last reference is removed on a #WebKitPermissionRequest and the request has not been handled, webkit_permission_request_deny() will be the default action. If the signal is not handled, the request will be completed automatically by the specific #WebKitPermissionRequest that could allow or deny it. Check the documentation of classes implementing #WebKitPermissionRequest interface to know their default action.generated/jsx.ts:11728
onPrint()?(self, printOperation) => boolean | nullEmitted 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.generated/jsx.ts:11740
onQueryPermissionState()?(self, query) => boolean | nullThis signal allows the User-Agent to respond to permission requests for powerful features, as specified by the Permissions W3C Specification. You can reply to the query using webkit_permission_state_query_finish(). You can handle the query asynchronously by calling webkit_permission_state_query_ref() on query and returning %TRUE. If the last reference of query is removed and the query has not been handled, the query result will be set to %WEBKIT_QUERY_PERMISSION_PROMPT.generated/jsx.ts:11750
onReadyToShow()?(self) => void | nullEmitted after #WebKitWebView::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().generated/jsx.ts:11759
onResourceLoadStarted()?(self, resource, request) => void | nullEmitted when a new resource is going to be loaded. The request parameter contains the #WebKitURIRequest that will be sent to the server. You can monitor the load operation by connecting to the different signals of resource.generated/jsx.ts:11766
onRunAsModal()?(self) => void | nullEmitted after #WebKitWebView::ready-to-show on the newly created #WebKitWebView when JavaScript code calls window.showModalDialog. The purpose of this signal is to allow the client application to prepare the new view to behave as modal. Once the signal is emitted a new main loop will be run to block user interaction in the parent #WebKitWebView until the new dialog is closed.generated/jsx.ts:11780
onRunColorChooser()?(self, request) => boolean | nullThis signal is emitted when the user interacts with a HTML element, requesting from WebKit to show a dialog to select a color. To let the application know the details of the color chooser, as well as to allow the client application to either cancel the request or perform an actual color selection, the signal will pass an instance of the #WebKitColorChooserRequest in the request argument. It is possible to handle this request asynchronously by increasing the reference count of the request. The default signal handler will asynchronously run a regular #GtkColorChooser for the user to interact with.generated/jsx.ts:11796
onRunFileChooser()?(self, request) => boolean | nullThis signal is emitted when the user interacts with a HTML element, requesting from WebKit to show a dialog to select one or more files to be uploaded. To let the application know the details of the file chooser, as well as to allow the client application to either cancel the request or perform an actual selection of files, the signal will pass an instance of the #WebKitFileChooserRequest in the request argument. The default signal handler will asynchronously run a regular #GtkFileChooserDialog for the user to interact with.generated/jsx.ts:11810
onScriptDialog()?(self, dialog) => boolean | nullEmitted when JavaScript code calls window.alert, window.confirm or window.prompt, or when onbeforeunload event is fired. The dialog parameter should be used to build the dialog. If the signal is not handled a different dialog will be built and shown depending on the dialog type: %WEBKIT_SCRIPT_DIALOG_ALERT: message dialog with a single Close button. %WEBKIT_SCRIPT_DIALOG_CONFIRM: message dialog with OK and Cancel buttons. %WEBKIT_SCRIPT_DIALOG_PROMPT: message dialog with OK and Cancel buttons and a text entry with the default text. %WEBKIT_SCRIPT_DIALOG_BEFORE_UNLOAD_CONFIRM: message dialog with Stay and Leave buttons. It is possible to handle the script dialog request asynchronously, by simply caling webkit_script_dialog_ref() on the dialog argument and calling webkit_script_dialog_close() when done. If the last reference is removed on a #WebKitScriptDialog and the dialog has not been closed, webkit_script_dialog_close() will be called.generated/jsx.ts:11840
onShowNotification()?(self, notification) => boolean | nullThis signal is emitted when a notification should be presented to the user. The notification is kept alive until either: 1) the web page cancels it or 2) a navigation happens. The default handler will emit a notification using libnotify, if built with support for it.generated/jsx.ts:11849
onShowOptionMenu()?(self, menu, rectangle) => boolean | nullThis signal is emitted when a select element in web_view needs to display a dropdown menu. This signal can be used to show a custom menu, using menu to get the details of all items that should be displayed. The area of the element in the #WebKitWebView is given as rectangle parameter, it can be used to position the menu. To handle this signal asynchronously you should keep a ref of the menu. The default signal handler will pop up a #GtkMenu.generated/jsx.ts:11860
onSubmitForm()?(self, request) => void | nullThis signal is emitted when a form is about to be submitted. The request argument passed contains information about the text fields of the form. This is typically used to store login information that can be used later to pre-fill the form. The form will not be submitted until webkit_form_submission_request_submit() is called. It is possible to handle the form submission request asynchronously, by simply calling g_object_ref() on the request argument and calling webkit_form_submission_request_submit() when done to continue with the form submission. If the last reference is removed on a #WebKitFormSubmissionRequest and the form has not been submitted, webkit_form_submission_request_submit() will be called.generated/jsx.ts:11874
onUserMessageReceived()?(self, message) => boolean | nullThis signal is emitted when a #WebKitUserMessage is received from the #WebKitWebPage corresponding to web_view. You can reply to the message using webkit_user_message_send_reply(). You can handle the user message asynchronously by calling g_object_ref() on message and returning %TRUE. If the last reference of message is removed and the message has not been replied to, the operation in the #WebKitWebPage will finish with error %WEBKIT_USER_MESSAGE_UNHANDLED_MESSAGE.generated/jsx.ts:11885
onWebProcessTerminated()?(self, reason) => void | nullThis signal is emitted when the web process terminates abnormally due to reason.generated/jsx.ts:11890
ref?Ref<WebKit.WebView>-generated/jsx.ts:11919
settings?WebKit.SettingsThe #WebKitSettings of the view.generated/jsx.ts:11419
zoomLevel?numberThe zoom level of the #WebKitWebView content. See webkit_web_view_set_zoom_level() for more details.generated/jsx.ts:11424