PopUp screen not opening In webview?
11,753
here is your solution
You must provide a chrome client that can handle alerts:
One should use a WebChromeClient to get these alerts and the functionality can be overwritten using theonJsAlert()
method. Hope this helps!
WebView wv=new WebView(this);
wv.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
//Required functionality here
return super.onJsAlert(view, url, message, result);
}
});
Check this link , and last comment , You have to use WebChromeClient for your purpose.
http://code.google.com/p/android/issues/detail?id=752
Author by
Kishan Dhamat
Sr. Android Application Developer Email: [email protected] Skype: kishan.dhamat Website: www.demoadda.com
Updated on August 07, 2022Comments
-
Kishan Dhamat over 1 year
I am Currently working with webview in which Javascript popup is created when some button is clicked in webview. But it is not opening in my Webview.
My code is Here:
wvPayements = (WebView) view.findViewById(R.id.wvPaymentsPage); wvPayements.getSettings().setLoadWithOverviewMode(true); wvPayements.getSettings().setUseWideViewPort(true); wvPayements.getSettings().setSupportZoom(true); wvPayements.getSettings().setAllowFileAccess(true); wvPayements.getSettings().setJavaScriptEnabled(true); wvPayements.getSettings() .setJavaScriptCanOpenWindowsAutomatically(true); wvPayements.getSettings().setBuiltInZoomControls(true); wvPayements.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, final String url) { dialog.cancel(); } }); wvPayements .loadUrl("http://192.168.0.114/Parch_ws/testalert.html");
-
Kishan Dhamat over 10 yearsThnx buddy..you saved my hours.
-
Swapnil Sonar over 9 yearsHello @Hardik, I used this method but this is not working in my case. Is there any other setting need to do?
-
Hardik over 9 years@SwapnilSonar you have to do using web chrome client.
-
Swapnil Sonar over 9 yearsActually we are working on web application in which we facilitating to user to login in app with
Linkedin
, it is fantastically work in web and android browser. But when we try to access it in android webview linkedin login popup/dialog is not open up.