Search code examples
androidwebviewandroid-webviewmailto

Email links inside Android Webview show as [email protected]


I'm working on a webview-based shopping app, the app has some legality pages like privacy policy, legal notices, and data protection, the client wants these pages to open even if the device doesn't have internet connection hence they should be cached.

These pages have a lot of emails and telephone numbers which, obviously, should be clickable, the problem is when I open these pages the emails appear like this:

E-Mail: <a href="/cdn-cgi/l/email-protection#a4d7c1d6d2cdc7c1e4cccdd6c9c1d689c3d6cbd7d7c189c3d6cbc1d7d7c1ca8ac0c1"><span class="__cf_email__" data-cfemail="f6859384809f9593b69e9f849b9384db918499858593db9184999385859398d89293">[email&#160;protected]</span></a>

The email on the website page looks very normal when I hit inspect:

<a href="mailto:[email protected]">[email protected]</a>

However, when I hit view page source, which is actually what I'm downloading and using as a cached file for the webpage, the email appears as the same one I have in my app, hence, the emails are invalid and not clickable.

The webview settings I'm using are the following:

WebSettings settings = webView.getSettings();
settings.setUserAgentString(MOBILE_USER_AGENT_STRING);
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setDomStorageEnabled(true);
settings.setAllowContentAccess(true);
settings.setAllowFileAccess(true);
CookieManager.getInstance().setAcceptCookie(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    // to auto play the videos (video as product image)
    settings.setMediaPlaybackRequiresUserGesture(false);
}

Any idea how I can tackle this? Is it related to the Webview settings I have or to the website configuration? Thanks in advance.


Solution

  • I have same isuuse,you can click the field [email protented],then it will tell you why happen this. How to slove it? Just open your CloudFlare setting and disabled Email Address Obfuscation in the Scrape Shield section.