Mailto链接不使用cordova在ios5中工作。

时间:2023-01-23 13:03:20

I have developed a mobile application using cordova 3.1. In android and IOS 7 mailto link is perfectly working. But in IOS 5 it is not working after i upgraded cordova form 3.0 to 3.1.

我开发了一个使用cordova 3.1的移动应用。在android和IOS 7中,mailto链接是完美的。但是在ios5中,当我升级了cordova的3.0到3.1之后,它就不工作了。

<a href="mailto:some@example.com">Example</a>

It is showing

这是显示

Failed to load webpage with error: The URL can't be shown. What am i missing?

页面加载失败:URL无法显示。我缺少什么?

1 个解决方案

#1


0  

Please try this on ios device

请在ios设备上试试

 $('.anchortag').on("click", function (e) {

        var emailBody = "Body of Content";

        var subject = "This is test Subject";
        document.location.href = "mailto:customer@email.com?subject=" + subject + "&body=" + emailBody;

    });

OR

    <div class="bottom-row">
       <a href="#" id="submitForm" title="Submit Answers">Submit Answers</a>
    </div>

    <form id="mailtoForm" action="mailto:test@gmail.com" target="_blank">
        <input type="hidden" name="Cc" value="">
        <input type="hidden" name="Bcc" value="">
        <input type="hidden" name="Subject" value="">
        <input type="hidden" name="Body" value="">
        <input type="submit" style="display:none">
    </form>



    $("#submitForm").on("click",function (e) {


       var emailBody = "Body of Content";

       var subject = "This is test Subject";

        $("#mailtoForm").find("input[name=Subject]").val(subject);
        $("#mailtoForm").find("input[name=Body]").val(emailBody);
        $("#mailtoForm").submit();


    });

#1


0  

Please try this on ios device

请在ios设备上试试

 $('.anchortag').on("click", function (e) {

        var emailBody = "Body of Content";

        var subject = "This is test Subject";
        document.location.href = "mailto:customer@email.com?subject=" + subject + "&body=" + emailBody;

    });

OR

    <div class="bottom-row">
       <a href="#" id="submitForm" title="Submit Answers">Submit Answers</a>
    </div>

    <form id="mailtoForm" action="mailto:test@gmail.com" target="_blank">
        <input type="hidden" name="Cc" value="">
        <input type="hidden" name="Bcc" value="">
        <input type="hidden" name="Subject" value="">
        <input type="hidden" name="Body" value="">
        <input type="submit" style="display:none">
    </form>



    $("#submitForm").on("click",function (e) {


       var emailBody = "Body of Content";

       var subject = "This is test Subject";

        $("#mailtoForm").find("input[name=Subject]").val(subject);
        $("#mailtoForm").find("input[name=Body]").val(emailBody);
        $("#mailtoForm").submit();


    });