Your e-mail address hidden with jQuery?

Last week we published an article with different methods to hide e-mail addresses on websites. Because of several comments with suggestions on how-to solve this problem, we provide this week a solution which is “from these days” and more powerful.

Based on the idea if you don’t show an address, a spambot can’t see it, we use in our example a simple Ajax call (using jQuery) and show a tiny box with some friendly message including the link with e-mail address.
DEMO: We used the code from this tutorial on the this page.

How does it work?

First we need to create a simple php file that holds the content and the e-mail address, we use json_encode to make the string less readable:

< ?php
// change the two vars below
$email = 'user@mail.com';
$html = 'Please contact us by e-mail: <a href="mailto:%%mAdr%%">%%mAdr%%<br /><br />
<a href="javascript:void(0);" id="hideme">Close</a>';
 
$eparts = explode('@', $email);
$data = array('ename'=>$eparts[0], 'dom'=>$eparts[1], 'htmlcode'=>$html);
echo json_encode($data);
?>

Don’t forget to block that file in your robots.txt file!

Read the rest of this entry »

 

Learn how transactional emails work.

Latest Articles

 

Popular Tags

adbrite adsense Advertising ajax api bbpress blog book review cms css curl database directadmin dns domain e-mail eCommerce forum ftp gadgets generator google hosting internet IP address jquery links modules mysql php phpmyadmin plugin register review scripts search seo shopping cart social sites spam templates themes thickbox traffic upload Web 2.0 webmaster website monitoring wordpress wordpress themes