Skip to content

bugfix: Webview js fix mobile devices#6269

Closed
gopalparashar421 wants to merge 3 commits intoflet-dev:mainfrom
gopalparashar421:webview-js-fix-mobile-devices
Closed

bugfix: Webview js fix mobile devices#6269
gopalparashar421 wants to merge 3 commits intoflet-dev:mainfrom
gopalparashar421:webview-js-fix-mobile-devices

Conversation

@gopalparashar421
Copy link
Copy Markdown

@gopalparashar421 gopalparashar421 commented Mar 6, 2026

Description

JavaScript was not working earlier on Webview component on Mobile devices because the default JavaScript mode was set to restricted. Explicitly enabled JavaScript support by setting the mode to unrestricted
Fixes: #114 #5200

Test Code

# Can be tested by running your existing Webview app or example from Docs on Android/iOS. Test code could not be provided since it'll require an HTML for testing.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I signed the CLA.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass locally with my changes
  • I have made corresponding changes to the documentation (if applicable)

Additional details

I have tested this on one of my personal applications where I created an HTML file with React JS to check state management and hooks.

Summary by Sourcery

Enable full JavaScript support for the WebView component on mobile platforms and bump the WebView package version.

Bug Fixes:

  • Ensure WebView JavaScript executes correctly on mobile devices by setting the JavaScript mode to unrestricted.

Build:

  • Bump the flet_webview Flutter package version from 0.1.0 to 0.2.0.

Documentation:

  • Document the WebView JavaScript enablement fix in the main and package-specific changelogs.

Set controller.setJavaScriptMode(JavaScriptMode.unrestricted) in webview_mobile_and_mac.dart to allow JavaScript execution in mobile/mac WebView. Bump package version from 0.1.0 to 0.2.0 in pubspec.yaml.
Add 0.82.0 entries to CHANGELOG.md and packages/flet/CHANGELOG.md documenting a bug fix: enable JavaScript support for mobile devices.
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@gopalparashar421 gopalparashar421 changed the title Webview js fix mobile devices bugfix: Webview js fix mobile devices Mar 6, 2026
@ndonkoHenri
Copy link
Copy Markdown
Contributor

We have an async method for that: https://docs.flet.dev/webview/#flet_webview.WebView.set_javascript_mode ?

@FeodorFitsner
Copy link
Copy Markdown
Contributor

Yep, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: implement javascript bridge (web client)

3 participants