Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Protecting e-mail address in XHTML

Reply
Thread Tools

Protecting e-mail address in XHTML

 
 
Kerberos
Guest
Posts: n/a
 
      12-22-2004
I have XHTML pages that I deliver as application/xhtml+xml
I used to have a Javascript that hid an e-mail address from spam bots, but
displayed properly the e-mail address on web browsers.
How would you show an e-mail address in the browser but protecting it from
spam bots?
What works for text/html doesn't for application/xhtml+xml, such as
document.write...
Do you have a solution?
Thanks,

--

Kerberos.

http://www.opera.com
http://www.freebsd.org
http://www.auriance.com
http://www.osresources.com
http://exodus.jabberstudio.org
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      12-23-2004
On Wed, 22 Dec 2004 19:34:33 -0200, Kerberos <> wrote:

>I have XHTML pages that I deliver as application/xhtml+xml


Well stop it ! (read Appendix C or c.i.w.a.h )

>I used to have a Javascript that hid an e-mail address from spam bots, but
>displayed properly the e-mail address on web browsers.


So your problem is nothing to do with email addresses at all, and is
really to do with how to embed JavaScript inside XHTML, without it
being non-well-formed XML.

Either hold the JavaScript in an external document, or use a CDATA
section.
--
Smert' spamionam
 
Reply With Quote
 
 
 
 
Kerberos
Guest
Posts: n/a
 
      12-23-2004
Em Thu, 23 Dec 2004 01:36:33 +0000, Andy Dingley <>
escreveu:

> Either hold the JavaScript in an external document, or use a CDATA
> section.


I created a page with an embedded JS protected by CDATA. The page is sent
with MIME type application/xhtml+xml:
http://www.auriance.com/clientes/cpe/essai2.php
It works fine with Opera, IE (sent as text/html in this case), but with
Firefox it won't show the email address.

--

Kerberos.

http://www.opera.com
http://www.freebsd.org
http://www.auriance.com
http://www.osresources.com
http://exodus.jabberstudio.org
 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      12-23-2004


Kerberos wrote:


> I created a page with an embedded JS protected by CDATA. The page is
> sent with MIME type application/xhtml+xml:
> http://www.auriance.com/clientes/cpe/essai2.php
> It works fine with Opera, IE (sent as text/html in this case), but with
> Firefox it won't show the email address.


With Mozilla/Firefox and Opera you can't use document.write in
application/xhtml+xml.
With Mozilla/Firefox you can't use innerHTML either with that content type.
Here is an example to solve the task using DOM scripting:
<http://home.arcor.de/martin.honnen/javascript/200412/test2004122302.xhtml>

I am not sure however that approach to the email harvesting protection
is a viable one but perhaps you can use the script code.

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      12-23-2004
On Thu, 23 Dec 2004 09:49:21 -0200, Kerberos <> wrote:

>http://www.auriance.com/clientes/cpe/essai2.php


Why not post this to c.i.w.a.h instead ? The script author is a
regular poster there.

 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      12-23-2004
On Thu, 23 Dec 2004 09:49:21 -0200, Kerberos <> wrote:

>I created a page with an embedded JS protected by CDATA.


Your script is built out of dodgy IE-specific JScript.

e.innerHTML = "<a href=\"mailto:" + address + "\">" + address +
"</a>";


I haven;'t looked closely, but I think Opera supports this, Mozilla /
Firefox don't (sadly). You can achieve similar results in a compliant
manner, but with a _lot_ more code -- you'd need to create a <link>
element as a JavaScript object with document.createElement() and then
insert it into the HTML document with HTMLDomElement.appendChild()

--
Smert' spamionam
 
Reply With Quote
 
Kerberos
Guest
Posts: n/a
 
      12-23-2004
Em Thu, 23 Dec 2004 14:09:00 +0100, Martin Honnen <>
escreveu:

> Here is an example to solve the task using DOM scripting:
> <http://home.arcor.de/martin.honnen/javascript/200412/test2004122302.xhtml>


At last! Thanks, it's working on "major" browsers, including Opera that I
use as default browser.
Take care,

--

Kerberos.

http://www.opera.com
http://www.freebsd.org
http://www.auriance.com
http://www.osresources.com
http://exodus.jabberstudio.org
 
Reply With Quote
 
Randal L. Schwartz
Guest
Posts: n/a
 
      12-24-2004
>>>>> "Kerberos" == Kerberos <> writes:

Kerberos> How would you show an e-mail address in the browser but protecting it
Kerberos> from spam bots?

Please <a href="mailto:merlyn@stonehenge.com">send
mail to me at <tt>merlyn@stonehenge.com</tt></a> and I'll reply.

That's sufficient for today's bots. Unlikely need to change, because
there's SOO many low hanging fruit there. No Javascript required. Nothing
fancy. Just replace the @ with @ and you're done.

Spammers do *not* de-entitize. This has been observed repeatedly. There's
no point in working harder than you must.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
 
Reply With Quote
 
David Håsäther
Guest
Posts: n/a
 
      12-24-2004
Randal L. Schwartz <> wrote:

> Spammers do *not* de-entitize. This has been observed repeatedly.


If you have a report or similar saying that, I would be interested in
reading it (sounds like I don't believe you, I know, but that's not the
case

--
David Håsäther
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PSD to XHTML Conversion, PSD to HTML, Joomla, Drupal, WordpressConversion, PSD to XHTML CSS xhtml champs C Programming 0 08-01-2011 06:29 AM
convert xhtml to another xhtml using xslt Usha2009 XML 0 12-20-2009 01:13 PM
Should I Convert Site To XHTML or XHTML mobile? chronos3d HTML 9 12-05-2006 04:46 PM
Protecting Address Book Quercus Robur Computer Security 3 11-15-2006 05:28 AM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM



Advertisments