Skip to content

WebView on the Android platform is unable to execute JavaScript. #14

@lgs888

Description

@lgs888

Duplicate Check

  • I have searched the opened issues and there are no duplicates

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

  1. 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

Captures

Image

[Upload media here]

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

lgs888 commented on May 10, 2025

@lgs888
Author

@FeodorFitsner @ndonkoHenri Could you please help me with an answer?

gopalparashar421

gopalparashar421 commented on Jun 24, 2025

@gopalparashar421

@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

gopalparashar421 commented on Jul 1, 2025

@gopalparashar421

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

ndonkoHenri commented on Jul 1, 2025

@ndonkoHenri
Contributor

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.

transferred this issue fromflet-dev/fleton Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lgs888@ndonkoHenri@gopalparashar421

        Issue actions

          WebView on the Android platform is unable to execute JavaScript. · Issue #14 · flet-dev/flet-webview