Elegant 'MailTo' Replacement
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.
![[Lavanya Deepak]](http://img.photobucket.com/albums/v31/vdeepakkumar/lvdp.gif)

![[Microsoft Certified Professional]](http://img12.photobucket.com/albums/v31/vdeepakkumar/mcp.gif)



0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home