wv.getSettings().setSupportMultipleWindows(true);
wv.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;
}
});
* 이미지 링크일경우 따로 처리
HitTestResult result = view.getHitTestResult();
if (result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
Message hrefMsg = new Message();
view.requestFocusNodeHref(hrefMsg);
String url = (String) hrefMsg.getData().get("url");
}
댓글
댓글 쓰기