search

Home  >  Q&A  >  body text

android - webview强制新开窗口

我想要浏览器实现强制新开窗口功能,即每点击一个链接总是强制创建一个webview去加载,请问如何实现?

天蓬老师天蓬老师2772 days ago696

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 17:31:18

    //The code is as follows

    webView.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    view.stopLoading();   //停止加载url
                    Intent intent = new Intent(XXX.this, WebActivity.class);
                    startActivity(intent);
                    return  true;
                }  
            });
            

    Hope it’s useful to you, the above

    reply
    0
  • 迷茫

    迷茫2017-04-17 17:31:18

    Link description

    This is okay

    reply
    0
  • Cancelreply