Elegant 'MailTo' Replacement
MailTo tags have become a bane to all websites since spammers run spam robots which crawl the web to capture the email addresses, add to their catalogs and send spams to them. I just thought of sharing with others a simple JavaScript function which would trigger open the default email client instead of having mailto: embedded in the HTML Page.
Just have the following function included in your webpage
<script language='Javascript'>
function WriteMailTo(user,domain)
{
location.replace ('mailto:'+user+'@'+domain);
}
</script>
And whereever you want to invoke the mailto, just called WriteMailTo('user','example.com') and the user's default email client should be launching (if configured) without any hassles.
MailTo tags have become a bane to all websites since spammers run spam robots which crawl the web to capture the email addresses, add to their catalogs and send spams to them. I just thought of sharing with others a simple JavaScript function which would trigger open the default email client instead of having mailto: embedded in the HTML Page.
Just have the following function included in your webpage
<script language='Javascript'>
function WriteMailTo(user,domain)
{
location.replace ('mailto:'+user+'@'+domain);
}
</script>
And whereever you want to invoke the mailto, just called WriteMailTo('user','example.com') and the user's default email client should be launching (if configured) without any hassles.
No comments:
Post a Comment