Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Hiding mail addresses in mailto: with JavaScript

by diotalevi (Canon)
on Oct 24, 2003 at 17:37 UTC ( [id://301903]=note: print w/replies, xml ) Need Help??


in reply to Hiding mail addresses in mailto: with JavaScript

Well, no. It isn't better because now I can't use that from my JavaScript-less browser anymore. Also, you might want to deuglify your regex (and improve its power) thusly. You're getting into very, very deep water by trying to parse the other parts of the html document but if you restrict yourself to just the mailto: URIs then you're probably ok.

s( (['"]) \s* (mailto: (?s:.)+) \1 )( your_function( $2 ) )ge

Replies are listed 'Best First'.
Re: Re: Hiding mail addresses in mailto: with JavaScript
by projekt21 (Friar) on Oct 24, 2003 at 19:12 UTC

    You might have noticed that I've added a commented noscript-part for JavaScript-less browsers. The noscript part would only display the mail address in a form like user{at}domain.com. Other forms can be done easily. In the war against spam we sometimes have to make compromises.

    I dislike the use of JavaScript for important things (navigation et al.). IMHO, a website needs to be functional without JS. On the other side all modern browsers are capable of JavaScript but the harvesters are not.

    For the deep water: yes, you might be right, but as I have control over the html code, I might catch every mailto. Or I might miss one and expose an address to a spammer. I can live with this. Your regex won't help, as it catches less then mine. Furtheron I would not be able to use the javascript replacement.

    I have an alternative implementation using HTML::TokeParser. This should avoid deep water but performs worse that that regex. Another compromise.

    Anyway, many thanks for your remarks. This code is just a suggestion, I don't force anybody to use it. Besides the JS thing, do you think it's badly implemented?

    alex pleiner <alex@zeitform.de>
    zeitform Internet Dienste

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://301903]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-25 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found