如何使用javascript从webview内部打开移动浏览器上的窗口(poup)? [英] How to open a window(poup) on mobile browser from inside a webview using javascript?

查看:29
本文介绍了如何使用javascript从webview内部打开移动浏览器上的窗口(poup)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,如果在 webview 中加载它,那么页面应该在移动网络浏览器中重新加载,而不是在 webview 中.基本上我想将用户从 webview 发送到浏览器.这可以使用 javascript 或 jquery 吗?

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 browser from the webview. Is this possible using javascript or jquery?

推荐答案

以下是 webview 中对话框或弹出窗口的示例:

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();

这篇关于如何使用javascript从webview内部打开移动浏览器上的窗口(poup)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆