I'm displaying a webpage in a WebView and on the webpage, there is a button. When you click the button, a confirmation dialog is supposed to popup, but it doesn't show in my WebView. It does popup if I go to the same webpage in the android browser. Anyone know how to handle popup dialogs coming from a webpage inside your WebView?
this my code
public class MainActivity extends AppCompatActivity {
private WebView webv;
private ProgressBar progressBar;
private String url = "https://www.k.com";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webv = (WebView) findViewById(R.id.webview);
webv.setWebViewClient(new WebViewClient());
webv.getSettings().setJavaScriptEnabled(true);
webv.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
webv.getSettings().setDomStorageEnabled(true);
webv.getSettings().setSupportMultipleWindows(true);
WebSettings webset = webv.getSettings();
webset.setJavaScriptEnabled(true);
webv.loadUrl(url);
webv.getSettings().setBuiltInZoomControls(true);
webv.getSettings().setSupportZoom(true);
}
@Override
public void onBackPressed() {
if (webv.isFocused() && webv.canGoBack()) {
webv.goBack();
} else {
super.onBackPressed();
finish();
}
}
}