【问题标题】:mailto: link not working on mobile devices in IOSmailto:链接在 IOS 的移动设备上不起作用
【发布时间】:2019-10-12 15:52:32
【问题描述】:

我想通过单击按钮在移动设备上打开本机/默认电子邮件应用程序。函数如下:

function openLink() { 
  return window.open(`mailto:${emailAddress}?subject=${subject}&body=${body}`, 'mailtoWindow')
}

如果在移动设备上的 chrome 上打开,则在其他浏览器上打开默认/本机邮件客户端时不会发生任何事情。

【问题讨论】:

  • 你是在模拟器还是真机上签到?
  • @ForamTrada 真机

标签: javascript html email


【解决方案1】:
<a href="#" name="emailLink" id="emailLink">Email</a>

$(function () {
  $('#emailLink').on('click', function (event) {
      event.preventDefault();
    alert("Huh");
    var email = 'test@theearth.com';
    var subject = 'Circle Around';
    var emailBody = 'Some blah';
    window.location = 'mailto:' + email + '?subject=' + subject + '&body=' +   emailBody;
  });
});

【讨论】:

    猜你喜欢
    • 2013-09-23
    • 2016-07-12
    • 2018-11-12
    • 1970-01-01
    • 1970-01-01
    • 2017-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多