Struct wry::webview::WebView

source ·
pub struct WebView { /* private fields */ }
Expand description

The fundamental type to present a WebView.

WebViewBuilder / WebView are the basic building blocks to construct WebView contents and scripts for those who prefer to control fine grained window creation and event handling. WebView presents the actual WebView window and let you still able to perform actions during event handling to it. WebView also contains the associate Window with it.

Implementations§

Create a WebView from provided Window. Note that calling this directly loses abilities to initialize scripts, add ipc handler, and many more before starting WebView. To benefit from above features, create a WebViewBuilder instead.

Platform-specific behavior:

  • Unix: This method must be called in a gtk thread. Usually this means it should be called in the same thread with the EventLoop you create.

Get the Window associate with the WebView. This can let you perform window related actions.

Get the current url of the webview

Evaluate and run javascript code. Must be called on the same thread who created the WebView. Use EventLoopProxy and a custom event to send scripts from other threads.

Launch print modal for the webview content.

Open the web inspector which is usually called dev tool.

Platform-specific
  • Android / iOS: Not supported.

Close the web inspector which is usually called dev tool.

Platform-specific
  • Windows / Android / iOS: Not supported.

Gets the devtool window’s current visibility state.

Platform-specific
  • Windows / Android / iOS: Not supported.

Set the webview zoom level

Platform-specific:
  • Android: Not supported.
  • macOS: available on macOS 11+ only.
  • iOS: available on iOS 14+ only.

Specify the webview background color.

The color uses the RGBA format.

Platfrom-specific:
  • macOS / iOS: Not implemented.
  • Windows:
    • On Windows 7, transparency is not supported and the alpha value will be ignored.
    • On Windows higher than 7: translucent colors are not supported so any alpha value other than 0 will be replaced by 255

Trait Implementations§

Executes the destructor for this type. Read more
Returns Webkit2gtk Webview handle

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.