-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Duplicate Check
- I have searched the opened issues and there are no duplicatesTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Describe the bug
I attempted to run WebView on the Android platform, but found that it couldn't execute JavaScript. This issue doesn't exist on the web platform. Could you please tell me what might be the reason for this? flet==0.27.6 flet-webview==0.1.0 python==3.12 Android version 12
Code sample
Code
import flet as ft
from flet_webview import WebView
def main(page: ft.Page):
wv = WebView(
url="https://www.aixzzs.com/web/#/",
enable_javascript=True,
on_page_started=lambda _: print("Page started"),
on_page_ended=lambda _: print("Page ended"),
on_web_resource_error=lambda e: print("Page error:", e.data),
expand=True,
)
page.add(wv)
ft.app(main)
To reproduce
- Build the application as an APK(arm64-v8a). 2. Install the APK on an Android device or emulator.
Expected behavior
The expectation is that WebView on the Android platform can execute JavaScript and display interactive web pages.
Screenshots / Videos
Operating System
Linux
Operating system details
Build environment: Debian 12 operating environment: Android version: 12(arm64-v8a)
Flet version
flet==0.27.6
Regression
No, it isn't
Suggestions
No response
Logs
Logs
[Paste your logs here]
Additional details
No response
Activity
lgs888 commentedon May 10, 2025
@FeodorFitsner @ndonkoHenri Could you please help me with an answer?
gopalparashar421 commentedon Jun 24, 2025
@FeodorFitsner @ndonkoHenri - Guys we need help here. We're unable to run (or validate?) the JavaScript code in the WebViw. I'm trying to send JS code using a Text Field.
gopalparashar421 commentedon Jul 1, 2025
Hi team!
I found the fix for this. We need to edit the .dart file where the WebView controller is instantiated and add the Javascript mode to unrestricted.
Let me know if you need to know the specific file and code that you need to edit.
@ndonkoHenri @FeodorFitsner - I saw that you have made some changes in the Alpha release of the Webview. Let's also ensure that in the Dart file, the WebView controller is setting the Javascript mode to unrestricted.
ndonkoHenri commentedon Jul 1, 2025
Sure!
You can open a PR in the flet-webview repo with the modification and let's discuss from there.
If you can't, then just point the modifications to be done and we will have a look.