I'm trying to use mailto
from a web app that needs to work on mobile devices (angularjs with ionic framework), so that on click, it opens the default email app.
My first attempt was to use href="mailto:my@mail.com"
but that didn't work.
So, I did some reseach, and tried all the method I was able to find, but none of them worked.
Here's what I tried:
- href="mailto:my@mail.com"
- href="mailto:my@mail.com" data-rel="external"
- href="mailto:my@mail.com" target="_blank"
- href="mailto:my@mail.com" data-rel="external" target="_blank"
Then I also tried with onClick
and javascript
- onclick="window.location='mailto:my@mail.com';return false;"
- onclick="window.location='mailto:my@mail.com';return false;" target="_blank"
- onclick="window.location='mailto:my@mail.com';return false;" data-rel="external"
- onclick="window.location='mailto:my@mail.com';return false;" data-rel="external" target="_blank"
They all works on a desktop, but none of them worked on Android (can't test iOS at the moment)
How can I achieve this? mailto
to work on desktop, ios and android? Thanks a lot.
PS: If it helps, I'm building the app using cordova
and I'm also using crosswalk
Thanks for any help
The first option you listed should work. Make sure your config.xml
has en entry for something like this:
<allow-intent href="mailto:*" />
This will ensure that mailto
is handled by your whitelist.