Reputation: 14283
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:[email protected]"
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:[email protected]"
- href="mailto:[email protected]" data-rel="external"
- href="mailto:[email protected]" target="_blank"
- href="mailto:[email protected]" data-rel="external" target="_blank"
Then I also tried with onClick
and javascript
- onclick="window.location='mailto:[email protected]';return false;"
- onclick="window.location='mailto:[email protected]';return false;" target="_blank"
- onclick="window.location='mailto:[email protected]';return false;" data-rel="external"
- onclick="window.location='mailto:[email protected]';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
Upvotes: 2
Views: 4253
Reputation: 2533
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.
Upvotes: 1