Issue
Problem resolved, I forgot to add this line:
myWebView.getSettings().setJavaScriptEnabled(true);
I havew a WebView with a email link.
Here is my HTML email link:
href="javascript:location.href='mailto:'+String.fromCharCode(97,110,105,109,97,108,115,64,109,100,112,105,46,99,111,109)+'?'">[email protected]</a>.</p>
I am trying to catch when the user clicks on this link with this code:
myWebView.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView wv, String url) {
if(url.contains("mailto")){
System.out.println("mailto");
}
return true;
}
});
But I am never entering in the if.
Solution
Here is the solution
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView wv, String url) {
if(url.contains("mailto")){
System.out.println("mailto");
}
return true;
}
});
Answered By - Milos Cuculovic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.