Previous Message
Next Message

Hide from Screen and Source

Sent by Susan Chouinard on 25 April 2005 20:08


Another good idea! I'm already using JavaScript to cloak the email addresses
so I can edit the script. I know that's off-topic so I'll cut this off here
but thank you very much.


Susan

-----Original Message-----
From: Eric Ladner [EMAIL-REMOVED]] 
Sent: Monday, April 25, 2005 8:58 AM
To: Susan Chouinard
Cc: [EMAIL-REMOVED]
Subject: Re: [css-d] Hide from Screen and Source

A javascript snippet like this works wonders (this one even has multiple
modes where it'll print either like "Your Name Here" or "Your Name Here
[EMAIL-REMOVED]>" or just [EMAIL-REMOVED]" as mailto: links in the document)

        <script type="text/javascript"><!--
        // lhs = left hand side, rhs = right hand side
        function printMailToLink(name, lhs, rhs, type)
        {
          document.write("<" + "A HREF=\"mailto" + ":" + lhs + "@" + rhs +
"\">");
          if (type == "full") {
            document.write(name + " - &lt;" + lhs + "@" + rhs + "&gt;");
          }
          if (type == "name") {
            document.write(name);
          }
          if (type == "address") {
            document.write(lhs + "@" + rhs);
          }    
          document.write("<" + "/a" + ">");
        }
      //-->
      </script>

Then, to use it in your page:

<script type="text/javascript">
  printMailToLink("Eric Ladner", "eric.ladner", "gmail.com", "address")
</script>

That'll kill 99.9% of page scraping since basially they are looking for
\w+@\w+.\w+ (I'm oversimplifying the regular expression, of course).

There's not much I know of that you can do along the lines of CSS with this.
The goal is to keep things out of the page that look like an email address
and CSS doesn't have the ability to change or generate content.  Although
there is a way to generate content with CSS2 as per the spec, IE doesn't
implement it, so you're still forced to work around it with something else.

Cheers.

On 4/25/05, Susan Chouinard [EMAIL-REMOVED]> wrote:
> I have set up a print version with CSS, and on the printed pages only 
> (it is a flyer), I want an email address to appear. I don't want to 
> put the email address in the source and just hide it from the screen 
> version using display:none since it can still be harvested that way.
> 
> Any suggestions that can implemented using CSS?
> 
> Susan
> 



--
Eric Ladner

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: