Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webview_flutter plugin JavaScript popup boxes are not shown #34853

Closed
ghost opened this issue Jun 21, 2019 · 10 comments
Closed

webview_flutter plugin JavaScript popup boxes are not shown #34853

ghost opened this issue Jun 21, 2019 · 10 comments
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: webview The WebView plugin package flutter/packages repository. See also p: labels.

Comments

@ghost
Copy link

ghost commented Jun 21, 2019

In Android WebView, JavaScript popups normally work without any extra coding in the WebView. Unfortunately, they are not working in my app using webview_flutter plugin.

Steps to Reproduce

You can reproduce by setting your webview_flutter plugin running on Android url to: 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm' and clicking the "try it" button.

Logs

[+5119 ms] D/ViewRootImpl@b42e355[MainActivity](26027): ViewPostIme pointer 0 

[  +93 ms] D/ViewRootImpl@b42e355[MainActivity](26027): ViewPostIme pointer 1 

[  +23 ms] W/cr_WebViewCallback(26027): Unable to create JsDialog without an Activity 

[   +2 ms] D/InputMethodManager(26027): HSIFW - flag : 0 Pid : 26027 

[        ] I/InputMethodManager(26027): hideSoftInputFromWindow ignore mServedView == null or mServedView.getWindowToken() != windowToken, mServedView :io.flutter.view.FlutterView{e9b5fd1 VFE...... .F....I. 0,0-1920,1200} 
@ghost ghost changed the title webview_flutter plugin does not display JavaScript alerts webview_flutter plugin JavaScript alerts are not shown Jun 21, 2019
@ghost ghost changed the title webview_flutter plugin JavaScript alerts are not shown webview_flutter plugin JavaScript popup boxes are not shown Jun 21, 2019
@jerryzhoujw
Copy link

Same in iOS's webview.

@jerryzhoujw
Copy link

You can use

flutter_webview_plugin:
    git:
      ref: "dev/fix_alert_not_work_in_webview"
      url: "https://github.com/jerryzhoujw/flutter_webview_plugin"
      source: git

this as temp in pubspec.yaml before merge PR

@ghost
Copy link
Author

ghost commented Aug 19, 2019

Thanks @jerryzhoujw but I believe you are referring to a completely different, "community" plugin, not the official webview_flutter plugin in this repository.

I can confirm that JavaScript alerts do work in flutter_webview_plugin. However, I will prefer to stay with the official webview_flutter plugin because I've already released an iOS version on the AppStore using that one.

I do recall reading somewhere that they wanted to merge these two plugins.

In the webview_flutter plugin, we are able to add our own JavaScript alert callbacks to FlutterWebView.m to show them, but I haven't found a way to make them work in Android using this plugin.

Objective-C callback method that I added to get JavaScript alert working in iOS:

-(void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:

@jerryzhoujw
Copy link

@nhojjava I have include the change in 2012 to fix iOS part. I'm not familiar android part, do you mean Android also didn't work with js alert ?

@ghost
Copy link
Author

ghost commented Aug 26, 2019

@jerryzhoujw That is correct.

@janmoppel janmoppel added customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: webview The WebView plugin plugin labels Sep 24, 2019
@janmoppel
Copy link

Hello @nhojjava !

Thank you for posting an issue.
Can you please also attach your flutter doctor -v command output?

Thank you.

@janmoppel janmoppel added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 24, 2019
@ghost
Copy link
Author

ghost commented Oct 1, 2019

@janmoppel here it is please understand my delayed response as I've moved away from this Flutter project due to lack of support and functionality by Flutter.

flutter doctor -v
[√] Flutter (Channel stable, v1.9.1+hotfix.4, on Microsoft Windows [Version 10.0.18362.356], locale en-US)
• Flutter version 1.9.1+hotfix.4 at C:\src\flutter
• Framework revision cc949a8 (4 days ago), 2019-09-27 15:04:59 -0700
• Engine revision b863200
• Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\bdrong\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 40.0.2
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] Connected device (1 available)
• SM T580 • 5200edd85b0dc4d7 • android-arm • Android 8.1.0 (API 27)

• No issues found!

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 1, 2019
@deandreamatias
Copy link

This issue it's the same as #30358 ?
If yes, maybe someone can close that issue

@VladyslavBondarenko
Copy link

Closing as duplicate of #30358

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: webview The WebView plugin package flutter/packages repository. See also p: labels.
Projects
None yet
Development

No branches or pull requests

4 participants