When using a mailto link chances are that it doesn\'t do anything for the user if he doesn\'t have an email client setup, or didn\'t setup his webmail to be his default client (
This article discusses a hack of checking if the window
's blur event fired after clicking the mailto. It uses a timeout, so it's not foolproof, but might address 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);