Skip to content Skip to sidebar Skip to footer

How To Open A Window(poup) On Mobile Browser From Inside A Webview Using Javascript?

I have a web page, which if loaded inside a webview, then the page should reload in a mobile web browser instead of inside the webview. Basically I want to send the user to a brow

Solution 1:

Here is example for dialog or popup in webview :

AlertDialog.Builder alert = new AlertDialog.Builder(this); 
alert.setTitle("Title here");

WebView wv = new WebView(this);
wv.loadUrl("http:\\www.google.com");
wv.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);

        return true;
    }
});

alert.setView(wv);
alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int id) {
        dialog.dismiss();
    }
});
alert.show();

Post a Comment for "How To Open A Window(poup) On Mobile Browser From Inside A Webview Using Javascript?"