WebView

The central class of the WPE WebKit and WebKitGTK APIs.

#WebKitWebView 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 #WebKitWebView or a data string. With #WebKitSettings you can control various aspects of the rendering and loading of the content.

Note that in WebKitGTK, #WebKitWebView is scrollable by itself, so you don't need to embed it in a #GtkScrolledWindow.

class WebView : WebViewBase {}

Constructors

this
this(void* ptr, Flag!"Take" take)
this
this()

Creates a new #WebKitWebView with the default #WebKitWebContext.

Members

Functions

callAsyncJavascriptFunction
void callAsyncJavascriptFunction(string body_, ptrdiff_t length, glib.variant.VariantG arguments, string worldName, string sourceUri, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously call body with arguments in the script world with name world_name of the main frame current context in web_view. The arguments values must be one of the following types, or contain only the following GVariant types: number, string and dictionary. The result of the operation can be a Promise that will be properly passed to the callback. If world_name is null, the default world is used. Any value that is not null is a distin ct world. The source_uri will be shown in exceptions and doesn't affect the behavior of the script. When not provided, the document URL is used.

callAsyncJavascriptFunctionFinish
javascriptcore.value.Value callAsyncJavascriptFunctionFinish(gio.async_result.AsyncResult result)

Finish an asynchronous operation started with webkit.web_view.WebView.callAsyncJavascriptFunction.

canExecuteEditingCommand
void canExecuteEditingCommand(string command, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously check if it is possible to execute the given editing command.

canExecuteEditingCommandFinish
bool canExecuteEditingCommandFinish(gio.async_result.AsyncResult result)

Finish an asynchronous operation started with webkit.web_view.WebView.canExecuteEditingCommand.

canGoBack
bool canGoBack()

Determines whether web_view has a previous history item.

canGoForward
bool canGoForward()

Determines whether web_view has a next history item.

canShowMimeType
bool canShowMimeType(string mimeType)

Whether or not a MIME type can be displayed in web_view.

connectAuthenticate
ulong connectAuthenticate(T callback, Flag!"After" after)

Connect to Authenticate signal.

connectClose
ulong connectClose(T callback, Flag!"After" after)

Connect to Close signal.

connectContextMenu
ulong connectContextMenu(T callback, Flag!"After" after)

Connect to ContextMenu signal.

connectContextMenuDismissed
ulong connectContextMenuDismissed(T callback, Flag!"After" after)

Connect to ContextMenuDismissed signal.

connectCreate
ulong connectCreate(T callback, Flag!"After" after)

Connect to Create signal.

connectDecidePolicy
ulong connectDecidePolicy(T callback, Flag!"After" after)

Connect to DecidePolicy signal.

connectEnterFullscreen
ulong connectEnterFullscreen(T callback, Flag!"After" after)

Connect to EnterFullscreen signal.

connectInsecureContentDetected
ulong connectInsecureContentDetected(T callback, Flag!"After" after)

Connect to InsecureContentDetected signal.

connectLeaveFullscreen
ulong connectLeaveFullscreen(T callback, Flag!"After" after)

Connect to LeaveFullscreen signal.

connectLoadChanged
ulong connectLoadChanged(T callback, Flag!"After" after)

Connect to LoadChanged signal.

connectLoadFailed
ulong connectLoadFailed(T callback, Flag!"After" after)

Connect to LoadFailed signal.

connectLoadFailedWithTlsErrors
ulong connectLoadFailedWithTlsErrors(T callback, Flag!"After" after)

Connect to LoadFailedWithTlsErrors signal.

connectMouseTargetChanged
ulong connectMouseTargetChanged(T callback, Flag!"After" after)

Connect to MouseTargetChanged signal.

connectPermissionRequest
ulong connectPermissionRequest(T callback, Flag!"After" after)

Connect to PermissionRequest signal.

connectPrint
ulong connectPrint(T callback, Flag!"After" after)

Connect to Print signal.

connectQueryPermissionState
ulong connectQueryPermissionState(T callback, Flag!"After" after)

Connect to QueryPermissionState signal.

connectReadyToShow
ulong connectReadyToShow(T callback, Flag!"After" after)

Connect to ReadyToShow signal.

connectResourceLoadStarted
ulong connectResourceLoadStarted(T callback, Flag!"After" after)

Connect to ResourceLoadStarted signal.

connectRunAsModal
ulong connectRunAsModal(T callback, Flag!"After" after)

Connect to RunAsModal signal.

connectRunColorChooser
ulong connectRunColorChooser(T callback, Flag!"After" after)

Connect to RunColorChooser signal.

connectRunFileChooser
ulong connectRunFileChooser(T callback, Flag!"After" after)

Connect to RunFileChooser signal.

connectScriptDialog
ulong connectScriptDialog(T callback, Flag!"After" after)

Connect to ScriptDialog signal.

connectShowNotification
ulong connectShowNotification(T callback, Flag!"After" after)

Connect to ShowNotification signal.

connectShowOptionMenu
ulong connectShowOptionMenu(T callback, Flag!"After" after)

Connect to ShowOptionMenu signal.

connectSubmitForm
ulong connectSubmitForm(T callback, Flag!"After" after)

Connect to SubmitForm signal.

connectUserMessageReceived
ulong connectUserMessageReceived(T callback, Flag!"After" after)

Connect to UserMessageReceived signal.

connectWebProcessTerminated
ulong connectWebProcessTerminated(T callback, Flag!"After" after)

Connect to WebProcessTerminated signal.

downloadUri
webkit.download.Download downloadUri(string uri)

Requests downloading of the specified URI string for web_view.

evaluateJavascript
void evaluateJavascript(string script, ptrdiff_t length, string worldName, string sourceUri, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously evaluate script in the script world with name world_name of the main frame current context in web_view. If world_name is null, the default world is used. Any value that is not null is a distinct world. The source_uri will be shown in exceptions and doesn't affect the behavior of the script. When not provided, the document URL is used.

evaluateJavascriptFinish
javascriptcore.value.Value evaluateJavascriptFinish(gio.async_result.AsyncResult result)

Finish an asynchronous operation started with webkit.web_view.WebView.evaluateJavascript.

executeEditingCommand
void executeEditingCommand(string command)

Request to execute the given command for web_view.

executeEditingCommandWithArgument
void executeEditingCommandWithArgument(string command, string argument)

Request to execute the given command with argument for web_view.

getAutomationPresentationType
webkit.types.AutomationBrowsingContextPresentation getAutomationPresentationType()

Get the presentation type of #WebKitWebView when created for automation.

getBackForwardList
webkit.back_forward_list.BackForwardList getBackForwardList()

Obtains the #WebKitBackForwardList associated with the given #WebKitWebView.

getBackgroundColor
void getBackgroundColor(gdk.rgba.RGBA rgba)

Gets the color that is used to draw the web_view background.

getCameraCaptureState
webkit.types.MediaCaptureState getCameraCaptureState()

Get the camera capture state of a #WebKitWebView.

getContext
webkit.web_context.WebContext getContext()

Gets the web context of web_view.

getCustomCharset
string getCustomCharset()

Returns the current custom character encoding name of web_view.

getDefaultContentSecurityPolicy
string getDefaultContentSecurityPolicy()

Gets the configured default Content-Security-Policy.

getDisplayCaptureState
webkit.types.MediaCaptureState getDisplayCaptureState()

Get the display capture state of a #WebKitWebView.

getEditorState
webkit.editor_state.EditorState getEditorState()

Gets the web editor state of web_view.

getEstimatedLoadProgress
double getEstimatedLoadProgress()

Gets the value of the #WebKitWebView:estimated-load-progress property.

getFavicon
gdk.texture.Texture getFavicon()

Returns favicon currently associated to web_view.

getFindController
webkit.find_controller.FindController getFindController()

Gets the #WebKitFindController.

getInputMethodContext
webkit.input_method_context.InputMethodContext getInputMethodContext()

Get the #WebKitInputMethodContext currently in use by web_view.

getInspector
webkit.web_inspector.WebInspector getInspector()

Get the #WebKitWebInspector associated to web_view

getIsMuted
bool getIsMuted()

Gets the mute state of web_view.

getIsWebProcessResponsive
bool getIsWebProcessResponsive()

Get whether the current web process of a #WebKitWebView is responsive.

getMainResource
webkit.web_resource.WebResource getMainResource()

Return the main resource of web_view.

getMicrophoneCaptureState
webkit.types.MediaCaptureState getMicrophoneCaptureState()

Get the microphone capture state of a #WebKitWebView.

getNetworkSession
webkit.network_session.NetworkSession getNetworkSession()

Get the #WebKitNetworkSession associated to web_view.

getPageId
ulong getPageId()

Get the identifier of the #WebKitWebPage corresponding to the #WebKitWebView

getSessionState
webkit.web_view_session_state.WebViewSessionState getSessionState()

Gets the current session state of web_view

getSettings
webkit.settings.Settings getSettings()

Gets the #WebKitSettings currently applied to web_view.

getSnapshot
void getSnapshot(webkit.types.SnapshotRegion region, webkit.types.SnapshotOptions options, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously retrieves a snapshot of web_view for region.

getSnapshotFinish
gdk.texture.Texture getSnapshotFinish(gio.async_result.AsyncResult result)

Finishes an asynchronous operation started with webkit.web_view.WebView.getSnapshot.

getTitle
string getTitle()

Gets the value of the #WebKitWebView:title property.

getTlsInfo
bool getTlsInfo(gio.tls_certificate.TlsCertificate certificate, gio.types.TlsCertificateFlags errors)

Retrieves the #GTlsCertificate associated with the main resource of web_view.

getUri
string getUri()

Returns the current active URI of web_view.

getUserContentManager
webkit.user_content_manager.UserContentManager getUserContentManager()

Gets the user content manager associated to web_view.

getWebExtensionMode
webkit.types.WebExtensionMode getWebExtensionMode()

Get the view's #WebKitWebExtensionMode.

getWebsitePolicies
webkit.website_policies.WebsitePolicies getWebsitePolicies()

Gets the default website policies.

getWindowProperties
webkit.window_properties.WindowProperties getWindowProperties()

Get the #WebKitWindowProperties object.

getZoomLevel
double getZoomLevel()

Set the zoom level of web_view.

goBack
void goBack()

Loads the previous history item.

goForward
void goForward()

Loads the next history item.

goToBackForwardListItem
void goToBackForwardListItem(webkit.back_forward_list_item.BackForwardListItem listItem)

Loads the specific history item list_item.

isControlledByAutomation
bool isControlledByAutomation()

Get whether a #WebKitWebView was created with #WebKitWebView:is-controlled-by-automation property enabled.

isEditable
bool isEditable()

Gets whether the user is allowed to edit the HTML document.

isLoading
bool isLoading()

Gets the value of the #WebKitWebView:is-loading property.

isPlayingAudio
bool isPlayingAudio()

Gets the value of the #WebKitWebView:is-playing-audio property.

loadAlternateHtml
void loadAlternateHtml(string content, string contentUri, string baseUri)

Load the given content string for the URI content_uri.

loadBytes
void loadBytes(glib.bytes.Bytes bytes, string mimeType, string encoding, string baseUri)

Load the specified bytes into web_view using the given mime_type and encoding.

loadHtml
void loadHtml(string content, string baseUri)

Load the given content string with the specified base_uri.

loadPlainText
void loadPlainText(string plainText)

Load the specified plain_text string into web_view.

loadRequest
void loadRequest(webkit.urirequest.URIRequest request)

Requests loading of the specified #WebKitURIRequest.

loadUri
void loadUri(string uri)

Requests loading of the specified URI string.

reload
void reload()

Reloads the current contents of web_view.

reloadBypassCache
void reloadBypassCache()

Reloads the current contents of web_view without using any cached data.

restoreSessionState
void restoreSessionState(webkit.web_view_session_state.WebViewSessionState state)

Restore the web_view session state from state

save
void save(webkit.types.SaveMode saveMode, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously save the current web page.

saveFinish
gio.input_stream.InputStream saveFinish(gio.async_result.AsyncResult result)

Finish an asynchronous operation started with webkit.web_view.WebView.save.

saveToFile
void saveToFile(gio.file.File file, webkit.types.SaveMode saveMode, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Asynchronously save the current web page.

saveToFileFinish
bool saveToFileFinish(gio.async_result.AsyncResult result)

Finish an asynchronous operation started with webkit.web_view.WebView.saveToFile.

self
WebView self()

Returns this, for use in with statements.

sendMessageToPage
void sendMessageToPage(webkit.user_message.UserMessage message, gio.cancellable.Cancellable cancellable, gio.types.AsyncReadyCallback callback)

Send message to the #WebKitWebPage corresponding to web_view.

sendMessageToPageFinish
webkit.user_message.UserMessage sendMessageToPageFinish(gio.async_result.AsyncResult result)

Finish an asynchronous operation started with webkit.web_view.WebView.sendMessageToPage.

setBackgroundColor
void setBackgroundColor(gdk.rgba.RGBA rgba)

Sets the color that will be used to draw the web_view background.

setCameraCaptureState
void setCameraCaptureState(webkit.types.MediaCaptureState state)

Set the camera capture state of a #WebKitWebView.

setCorsAllowlist
void setCorsAllowlist(string[] allowlist)

Sets the allowlist for CORS.

setCustomCharset
void setCustomCharset(string charset)

Sets the current custom character encoding override of web_view.

setDisplayCaptureState
void setDisplayCaptureState(webkit.types.MediaCaptureState state)

Set the display capture state of a #WebKitWebView.

setEditable
void setEditable(bool editable)

Sets whether the user is allowed to edit the HTML document.

setInputMethodContext
void setInputMethodContext(webkit.input_method_context.InputMethodContext context)

Set the #WebKitInputMethodContext to be used by web_view.

setIsMuted
void setIsMuted(bool muted)

Sets the mute state of web_view.

setMicrophoneCaptureState
void setMicrophoneCaptureState(webkit.types.MediaCaptureState state)

Set the microphone capture state of a #WebKitWebView.

setSettings
void setSettings(webkit.settings.Settings settings)

Sets the #WebKitSettings to be applied to web_view.

setZoomLevel
void setZoomLevel(double zoomLevel)

Set the zoom level of web_view.

stopLoading
void stopLoading()

Stops any ongoing loading operation in web_view.

terminateWebProcess
void terminateWebProcess()

Terminates the web process associated to web_view.

tryClose
void tryClose()

Tries to close the web_view.

Properties

gType
GType gType [@property getter]

Static functions

getGType
GType getGType()

Inherited Members

From WebViewBase

getGType
GType getGType()
gType
GType gType [@property getter]
self
WebViewBase self()

Returns this, for use in with statements.