Detection when mailto failed

When using the mailto link, the chances are that he does nothing for the user if he does not have the mail client settings or if he has not configured his web mail as the default client (ea. Gmail as the default client in macosx ). What would be the best way to elegantly suggest a backup by kindly asking the user to manually send you an email? I could use JS or css to display the message after clicking the link:

submit was successful, or if nothing happened, write us an email manually.

How about using the form with mailto, can I use the redirect page on successful completion without or using server-side scripts? Is there a way to filter success from failure instead of relying on the user's judgment to report double success / failure above?

edit: At least that would be the most appropriate way to change the state when the mailto link (or form) was clicked. JavaScript or css are obviously parameters, but I can't just create a double-action link or submit a form; mailto, as well as a link to another page (you sent / clicked the "button")

+8
javascript css forms mailto server-side
source share
3 answers

This article discusses problems with checking if the window blur event occurred after clicking mailto. It uses a timeout, so it is not reliable, but can handle most cases.

 (function($)) { $('a[href^=mailto]').each(function() { var href = $(this).attr('href'); $(this).click(function() { var t; var self = $(this); $(window).blur(function() { // The browser apparently responded, so stop the timeout. clearTimeout(t); }); t = setTimeout(function() { // The browser did not respond after 500ms, so open an alternative URL. document.location.href = '...'; }, 500); }); }); })(jQuery); 
+8
source share

You cannot determine if the user has a mail client setting. Therefore, I suggest that you configure the server form so that the user can contact you.

Above or above this, you can provide the user with a link explaining to him that if he wants to contact you directly through his main email account, he can click this link (this link is a mailto: link).

By giving him two ways to contact you (web form or email client), you give the user the opportunity to choose which one he wants to use. Therefore, he needs to understand whether the email client is installed and whether he wants to use it.

+1
source share

Use JavaScript to confirm the popup to ask the user if they have email settings on their computer.

0
source share

All Articles