Search code examples
iphoneweb-applicationsmobile-safarimailto

Error when using mailto: link in Mobile Safari in app-capable mode


I've got a form in a web page with an action that is "mailto:email" (where email is a real email address). When I load this page in Mobile Safari in regular mode (ie, not launched from home screen with app-capable mode), this works fine - after I submit the form, the email app comes up. However, when I'm in app-capable mode and have launched from the home screen (so, no Safari chrome), and submit the form I get the error "URL can't be shown". However, a regular mailto: link (ie, not in a form) does work when in app-capable mode.

Has anyone else noticed this? Any workarounds? Are forms disallowed in app-capable mode?

Thanks,

Elisabeth


Solution

  • This accurately describes the issue. There is nothing wrong with the mailto link, the mailto link fails to load. Often the webapp crashes.

    The funny thing is that tel: link for telephone numbers work fine.

    window.location.replace does in-fact work. Thanks!

    Here is the jQuery to fix this automatically...

    $('a[href^=mailto]').click(function (event) {
        event.preventDefault();
        window.location.replace = $(this).attr('href');
        return false;
    });