- This topic is empty.
-
AuthorPosts
-
July 22, 2009 at 8:17 am #25533
Hugo
MemberHi guys,
Was wondering – how do you obfuscate the e-mail addresses on your pages? I found some really nice ideas over here:
http://techblog.tilllate.com/2008/07/20 … -compared/
..but that does not cover wrapping the e-mail address in an anchor (mailto:[email protected]).. So how do you do this?I was actually looking for a non-javascript solution.
Regards,
-H
July 22, 2009 at 8:31 pm #61250mattvot
MemberI seriously cannot be the only one ever to think of this?!!!!
Maybe so. I just thought of this now, tested it and it worksMake an anchor link go to something like http://in.com/email.php and in that have the address code:
Code:You could even get adventurous:
Code:and make the anchor link hit http://in.com/email.php?f=mattvot&d=domain&t=.com
Here’s a more compressed version of the code above to reduce file size:
Code:So your final HTML markup would look something like this:
Code:Or even:
Code:July 22, 2009 at 9:17 pm #61253Chris Coyier
KeymasterYou’d have to sanitize the shit out of those variables, but it’s an interesting idea for sure.
July 22, 2009 at 9:33 pm #61254mattvot
Membercool. I’ve just thought I may launch a web app, similar to tinyurl for this sort of thing when I get the time
July 22, 2009 at 9:34 pm #61255danilolee
MemberThis is what I’ve been doing to hide my email address.
1. I utilize this CSS class (below) which reverts the orientation of the content from right to left.
Code:.email {
unicode-bidi: bidi-override;
direction: rtl;
}2. Then, I convert ASCII characters to Unicode at http://www.mikezilla.com/exp0012.html
3. The final code looks like:
Code:July 22, 2009 at 11:13 pm #61257mvaughn
ParticipantChris,
I’m a hack when it comes to PHP. I understand what’s going on with the code here but can you explain "sanitize the shit out of those variables" please?
thx
-MichaelJuly 23, 2009 at 5:10 am #61215Hugo
Member"mvaughn" wrote:Chris,I’m a hack when it comes to PHP. I understand what’s going on with the code here but can you explain "sanitize the shit out of those variables" please?
thx
-MichaelThe PHP code from above takes GET variables and uses them to execute a bit of code, but because GET variables are very easy to manipulate you should always limit the input possibilities (‘sanitizing’). This security thingie is similar to SQL injection (the Wikipedia article explains more)
@danilolee: There are crawlers/bots out there that can read out ASCII characters…
@mattvot: your PHP solution sounds like something, but I’ll have to keep looking for a non-PHP solution as some of my clients have a hosting provider that does not support php :-/.
I like your idea of the web app, I’d be glad to help you set up something for that. Just shoot me a PM.July 23, 2009 at 7:29 pm #61191bcdc_us
Participantdanilolee,
You can use this PHP function I wrote to convert to ascii.<?php
# http://bcdc.us
function mailacsii($name, $domain, $link=NULL) {
$email = $name . ‘@’ . $domain;
if (!$link): $link = $email; endif;
foreach (str_split($email) as $obj)
{
$ascii .= ‘&#’ . ord($obj) . ‘;’;
$output = ‘<a href="mailto:’ . $ascii . ‘">’. $link .'</a>’;
}
return $output;
}
?>
<html>
<!– usage examples –>
example a) <?php echo mailacsii(‘hello’, ‘world.com’, ‘Send Email’); ?><br />
example b) <?php echo mailacsii(‘hello’, ‘world.com’); ?>
</html> -
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.