javascript - Checking If the User clicked on Mail Link -
i have page email link
<a href="mailto:email@address.com?subject=test story&body=abc.com ">email link</a> i want check if user clicks on link open default email client, want update in database user has mailed. know happening @ client side, there way can check either user clicked on or not? onclick not there anchor tag. in regard.
you need listen click event on <a> tags "mailto:" link. assuming you're using jquery, here code:
$('a[href^="mailto:"]').on('click', function(e){ var email = $(this).attr('href').replace('mailto:', ''); // submit action server here. }); update: make sure code running after dom ready event, so:
jquery(function($){ $('a[href^="mailto:"]').on('click', function(e){ var email = $(this).attr('href').replace('mailto:', ''); // submit action server here. }); });
Comments
Post a Comment