WebView
Easily load web pages while allowing user interaction.
To build your Flet app that uses ads control add flet-webview
to dependencies
key of the [project]
section of your pyproject.toml
file, for
example:
[project]
...
dependencies = [
"flet==0.27.6",
"flet-webview==0.1.0",
]
Examples
A simple implementation that loads the flet.dev website:
loading...
Properties
bgcolor
Set the background color of the WebView.
enable_javascript
Enable or disable the JavaScript execution on the page. Note that disabling the JavaScript execution on the page may result to unexpected web page behaviour.
Value is of type bool
.
javascript_enabled
javascript_enabled
Enable or disable the JavaScript execution on the page. Note that disabling the JavaScript execution on the page may result to unexpected web page behaviour.
Value is of type bool
.
Deprecated in v0.25.0 and will be removed in v0.28.0. Use enable_javascript
instead.
prevent_link
Specify a prefix for links to prevent navigating or downloading.
Value is of type str
.
url
Start the WebView by loading the url
value.
Value is of type str
.
Methods
can_go_back()
Whether there's a back history item. Only for Android, iOS and macOS platforms.
Returns a bool
.
can_go_forward()
Whether there's a forward history item. Only for Android, iOS and macOS platforms.
clear_cache()
Clears all caches used by the WebView. Only for Android, iOS and macOS platforms.
The following caches are cleared:
- Browser HTTP Cache
- Cache API caches. Service workers tend to use this cache.
- Application cache