After pressing the HTML button, I am trying to launch the mailer using JavaScript.
I managed to boot it on Android after seeing the sample.
However, I am worried that it doesn't work well on iOS.
The model is iPad2, iOS9, and the code is
functionMailer(){
varmail_address = '[email protected]';
varmail_content="Android_testTest";
if(monaca.isAndroid===true){
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: 'mailto:'+mail_address+'?body='+mail_content
},
function() {},
function(){}
);
} else if(monaca.isIOS===true){
varmailto='[email protected]';
mailto=mailto+
US>"?subject=subject&body=body.%0D%0A is also trying to break a new line.";
location.href=mailto;
}
}
There seems to be no problem with location.href
, but it doesn't work well in my environment.
(It says iPad2, so I don't think this has anything to do with it...)
Xcode7 Simulator does not have a mailer (the Mail app), so naturally you cannot open the mailer from another app.Are you checking on the actual machine?
The value you set to location.href
in iOS does not include the mailto:
scheme (as found in url:
in Android).
var mailto='mailto:[email protected]';
Try adding tmailto: を to the beginning of the value set to location.href
as shown in .
I've never used Monaca, so I'd like to check with a regular UIWebView, but setting the string that does not contain "mailto:" to location.href
does not open the mailer.
© 2024 OneMinuteCode. All rights reserved.