Skip to content Skip to sidebar Skip to footer

How To Display An Email Address For Users But Hide From Robot? Is There A Simply Way To Do It Using Php, Javascript Or Jquery?

Is there an elegant and easy/simple way to do it using PHP, Javascript or Jquery?

Solution 1:

There are many ways of doing this. We've had som luck obfuscating source via python/javascript. Another simpler favourite is the CSS unicode-bidi technique:

div.contact { unicode-bidi:bidi-override; direction: rtl; }
<div class="contact">moc.rab@oof</div>

Prints out:

foo@bar.com

Solution 2:

You might want to look into reCAPTCHA Mailhide. It should be easy to use from PHP.

Solution 3:

You can use the PHP imagestring() function to create an image.

<?php// Create a 100*30 image$im = imagecreate(120, 30);

// White background and blue text$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// Write the email address at the top left
imagestring($im, 5, 0, 0, 'test@test.com', $textcolor);

// Output the image
header('Content-type: image/png');

imagepng($im);
imagedestroy($im);
?>

Solution 4:

Obfuscation using trickiest possible HTML entities and urlencode, implemented in PHP: http://hcard.geekhood.net/encode/

Source: http://code.google.com/p/hcardvalidator/source/browse/trunk/encode/index.php

Another approach I use is:

<ahref="mailto:me@myserver.removethis.com"><script>[…] a.href = a.href.replace(/removethis\./,'');</script>

It's worth noting that both techniques give users perfectly accessible, clickable link.

Solution 5:

you can try changing name@example.com to: "name at example dot com".

However, robots can easily account for this.

Otherwise, you could display a dynamic image of the email address if you are truly motivated.

Post a Comment for "How To Display An Email Address For Users But Hide From Robot? Is There A Simply Way To Do It Using Php, Javascript Or Jquery?"