javascript - Checking If the User clicked on Mail Link -


i have page email link

<a href="mailto:email@address.com?subject=test story&amp;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

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -