mailto links on android devices

02 / Sep / 2015 by Parampreet Singh 2 comments

Recently we added a feature that uses the mailto link. While testing it was found that working fine on Desktops, iPhones, and iPad’s but not on android devices. To debug it quickly, we created a test page with just mailto link in it as shown below

<a href="" target="_blank">Send Mail</a>

and then tested this test page, and guess what it works with the android device!!!.

So, this means that something is different or special in the actual (application’s) HTML. After investigating further, we realized that the ‘mailto’ link is placed within a nested iFrame instead of the top level page.

This concludes that this case was not getting handled on Android when mailto is within an iFrame.

Then to quickly try again, we updated the target attribute of the anchor tag to value “_top”. Miraculously it worked!!!

<a href="" target="_top">Send Mail</a>

Hope this helps!!!


comments (2)

  1. Jitendra Kumar

    Are you trying to say that you made some mistake and rectified it or which one is the final solution…I am bit confused..Can you explain it better mentioning the faulty code as both the code above working.

    1. Parampreet Singh

      Here is the actual code
      <a href="" target="_blank">Send Mail</a>

      Note the _blank attribute value for target, so changing it to _top makes it works on android


Leave a Reply

Your email address will not be published. Required fields are marked *