1

After upgrading my Nexus 7 to Android 5.1 alert() and confirm() boxes in my Webviews (WebChromeClient) are no longer executed.

SetJavaScriptEnabled is set to true and alert() and confirm() worked perfectly well in all earlier versions of Android.

Can anyone running Android 5.1 test this issue so I can confirm if this problem is only related to my device or if this is a bug in the Android 5.1 version?

Kalle
  • 610
  • 7
  • 14
  • Are you using your own `WebChromeClient` to handle those `alert()` and `confirm()` calls? – CommonsWare Apr 04 '15 at 11:38
  • Yes. And the alert() and confirm() calls are being made from the webpage and not from native code. – Kalle Apr 04 '15 at 12:30
  • Can you confirm if your `WebChromeClient` is getting control for `alert()` and `confirm()`, in `onJsAlert()` and `onJsConfirm()`? IOW, is the issue that you're not getting control, or that you are getting control but what you're doing in those methods is not working? – CommonsWare Apr 04 '15 at 12:35
  • The problem is that the dialogs are not opening up. Nothing happens! The methods are working correct. This problem have to be related to Android 5.1 as everything works perfectly on 5.0 and below. – Kalle Apr 04 '15 at 16:12
  • "The problem is that the dialogs are not opening up. Nothing happens!" -- that did not answer my questions. Are you showing the dialogs yourself, or are you having the default dialogs appear? If you are showing them yourself, we would need to see the code for how you are doing that to determine if there is anything specifically odd about their implementation. If, OTOH, you are relying upon the default dialogs, try temporarily removing your `WebChromeClient` and confirm what the behavior is. – CommonsWare Apr 04 '15 at 16:14
  • It's the default dialogs. I'll see if I can temporarily removing the WebChromeClient and check the result. – Kalle Apr 04 '15 at 16:53
  • I installed the "Web Browser for Android" by "mttcross" and the results are the same. alert() and confirm() boxes does not work on Android 5.1 on my Nexus 7 device. Can anybody else confirm this problem? – Kalle Apr 12 '15 at 10:09
  • Yes it is not showing the JS Alert in android 5.1, After uninstalling the updates for webview, it works. i couldn't find any documentation regarding this. – Tamilselvan Kalimuthu Apr 14 '15 at 07:23
  • any one filed a bug report for this? – kaho Apr 16 '15 at 20:30
  • Users are now starting to complain so I can now confirm that this is a bug in webview. – Kalle Apr 17 '15 at 08:07
  • The error log says: "W/JsDialogHelper(21113): Cannot create a dialog, the WebView context is not an Activity". Maybe a solution can be found here? http://stackoverflow.com/questions/26044179/showing-an-alertdialog-from-a-webview-outside-of-an-activity – Kalle Apr 17 '15 at 08:38

1 Answers1

1

It's along shot but works for me: My app crashes when displaying a webview on nexus 5 android 5.1. The errors was some codec related or other V8 and chromium stuff...

I found that after uninstalling the updates for "Android system webview" app (go to settings and look for it under "downloaded") it works just fine!

Hopes it helps...

user3193413
  • 575
  • 7
  • 10