WebView.HitTestResult只获取<img src=""/>而非<a href="">

时间:2016-04-04 05:58:09

标签: javascript android jquery html webview

I am trying to open new window with android browser using "_blank". I listen with this event.

  mWebView.getSettings().setSupportMultipleWindows(true);
             mWebView.setWebChromeClient(new WebChromeClient() {
                 @Override
                 public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, android.os.Message resultMsg)
                 {
                     WebView.HitTestResult result = view.getHitTestResult();
                     String data = result.getExtra();
                     Context context = view.getContext();

                     Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(data));
                     context.startActivity(browserIntent);
                     return false;

                 }

  });

But it opens only image url when clicking on Image Link . Not link. How to get anchor from WebView.HitTestResult. I don't want to open image type url. Thank you for interesting . Kindly help me Please.

0 个答案:

没有答案