views:

682

answers:

3

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

A: 

I think I've figured this out. I noticed when in app-capable mode, any http link will take you out of the app and launch a separate mobile safari window, take you to the page and show the Safari chrome. Makes sense (typically one wouldn't link to anything from an "all in one" app-capable web app. I noticed this because I implemented a 4 page app with my own "tab bar" at the bottom and was linking amongst the .html files with plain http links in the a element. When I replace this with a javascript function to load the pages using document.location.replace this doesn't happen.

So, on the form - I think what must be happening is that because I'm using a scheme (in this case, mailto:) somehow the browser is needed in "regular mode" to interpret the scheme and do the right thing by launching the email app and this clearly doesn't work when submitting a form. I haven't yet found anything in the Apple documentation specifically about this, so if anyone knows the technical details, please do post!

UPDATE: I did find that I can access a server side script using a form in web-app mode, so I'm still curious about the mailto: issue, if anyone has an answer.

Thanks,

Elisabeth

Elisabeth
A: 

hi, i am having the exact same issue with mailto link not working in the web capable mode. i just got done submitting a bug report to apple. lets see what happens, mean while i found an other dev. platform for web apps that works in web capable mode and mailto links work, but it is funny how it works in this ever, it is not as fluid as it is in safari. because even in this new web dev tool that i found, it closes your app and launches mail client, which is lame. in safari it just slides in a mail window that slides back out if you hit cancel or send, it doesnt actually closes your app.

hammad
Good on ya for filing a bug. Two questions: (1) what is the Radar number, and (2) have you posted it on http://openradar.appspot.com so others outside Apple can see it and file duplicates if desired?
Quinn Taylor
BTW, Mobile Safari can slide up a window because it's a native iPhone application, not a web app. Since MobileSafari handles external URL schemes, it can do things like that. It would seem the best solution would be to web apps launched from the home screen a little smarter in this regard. :-/
Quinn Taylor
A: 

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;
});
Does this solution really work for anyone? I've tried this out to no avail.
Boushley