Struct tauri_runtime::webview::WebviewAttributes [−][src]
pub struct WebviewAttributes { pub url: WindowUrl, pub initialization_scripts: Vec<String>, pub data_directory: Option<PathBuf>, pub uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>>, pub file_drop_handler_enabled: bool, }
Expand description
The attributes used to create an webview.
Fields
url: WindowUrl
initialization_scripts: Vec<String>
data_directory: Option<PathBuf>
uri_scheme_protocols: HashMap<String, Box<dyn Fn(&str) -> Result<Vec<u8>, Box<dyn Error>> + Send + Sync + 'static>>
file_drop_handler_enabled: bool
Implementations
Sets the init script.
Data directory for the webview.
Whether the webview URI scheme protocol is defined or not.
Registers a webview protocol handler. Leverages setURLSchemeHandler on macOS, AddWebResourceRequestedFilter on Windows and webkit-web-context-register-uri-scheme on Linux.
Arguments
uri_scheme
The URI scheme to register, such asexample
.protocol
the protocol associated with the given URI scheme. It’s a function that takes an URL such asexample://localhost/asset.css
.
Disables the file drop handler. This is required to use drag and drop APIs on the front end on Windows.