Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes URL returned when taping image with href in onCreateWindow [Android] #1042

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,16 @@ public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGest
WebView.HitTestResult result = view.getHitTestResult();
String url = result.getExtra();

// Ensure that images with hyperlink return the correct URL, not the image source
if(result.getType() == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
Message href = view.getHandler().obtainMessage();
view.requestFocusNodeHref(href);
String imageUrl = href.getData().getString("url");
if(!imageUrl.isEmpty()) {
url = imageUrl;
}
}

URLRequest request = new URLRequest(url, "GET", null, null);
CreateWindowAction createWindowAction = new CreateWindowAction(
request,
Expand Down